Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5743

Check each item's repeat times within a list

$
0
0

@Jack_Zeng wrote:

Hi All,

Actually I got 2 question...I guess it could be achieved by some basic syntax in Python.
When I have a list like [0,0,1,1,1,1,3,3,3,3,3,3,3,4,4,4,4,4,5,5 ... ], how can I eliminate the repeated items to be a list like [0,1,3,4,5 ... ]? Is there a way to apply on int, str and even geometries?

Another question is, how can we calculation each item's repeat times with a list?
Take the same list for example, [0,0,1,1,1,1,3,3,3,3,3,3,3,4,4,4,4,4,5,5 ... ] to [2,4,7,5,2 ... ].

Thanks for any help,

Jack

Posts: 16

Participants: 6

Read full topic


Viewing all articles
Browse latest Browse all 5743

Trending Articles