torsdag 17. november 2016

Ammo: Sliding Windows - Python tip of the day

Just a quick Python tip of the day.

I regularly find my self in the position of needing to slice lists with "sliding windows"

Like if I have the list {1,2,3,4,5,6,7,8} I would like to return {{1,2},{2,3},{3,4}..etc}

Just found this great way of doing it in dynamo. (I'm sure there are many ways of doing it, but quite simple this one anyways.)

1 kommentar:

  1. Hey there Jostein, there is a node List.Sublists that does this and a little more, you should give it a look. -Nick Curtis