Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: iterating over a list as if it were a circular list

Reply
Thread Tools

Re: iterating over a list as if it were a circular list

 
 
Chris Angelico
Guest
Posts: n/a
 
      03-07-2013
On Thu, Mar 7, 2013 at 8:23 PM, Sven <(E-Mail Removed)> wrote:
> Now I would like to iterate over P and place one N at each point. However if
> you run out of N I'd like to restart from N[0] and carry on until all the
> points have been populated.


Check out itertools.cycle, it should do what you want.

ChrisA
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iterating over a list as if it were a circular list Sven Python 3 03-08-2013 05:59 PM
iterating over a list as if it were a circular list Sven Python 1 03-07-2013 01:37 PM
Re: iterating over a list as if it were a circular list Chris Rebert Python 0 03-07-2013 09:38 AM
Re: iterating over a list as if it were a circular list Sven Python 0 03-07-2013 09:34 AM
Re: iterating over a list as if it were a circular list Chris Rebert Python 0 03-07-2013 09:31 AM



Advertisments