What is the best way to set a start index when iterating a list in Python. For example, I have a list of the days of the week - Sunday, Monday, Tuesday, ... Saturday - but I
stdlib will hook you up son!
deque.rotate():
#!/usr/local/bin/python2.7 from collections import deque a = deque('Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ')) a.rotate(3) deque(['Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday'])