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

Slicing a list at integer of when an element is different from the previous

$
0
0

@aeaechan96 wrote:

0

I need to be able to slice a list of points into multiple sublists, to act as a guide for slicing another list.

My list right now is y_vals = [a,a,a,a,a,a,b,b,b,b,b,b,b,b,b,b,b,c,c,c,c,c…] and I need it to slice every time the number changes. a, b and c are actual numbers, but the numbers are rather long, so I typed it out in a,b,c.

I wanted to use the slicing method of [:x], but it’s a list of 5000 over numbers, and I’m not sure how to slice a list. Thank you in advance!

Posts: 8

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 5745

Trending Articles