On 2017-05-30 17:25, Beppe wrote:
hi all

I've a tuple, something like

x = ("A","B","C","D","E","F","G","H",)

I would want to iterate on all tuple's elements
starting from a specific index


something like

Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
x = ("A","B","C","D","E","F","G","H",)
for i in x[2:]:
...     print i
...
C
D
E
F
G
H




with the difference that I would want to restart from the beginning when I 
reach the end of the tupla


C
D
E
F
G
H
A
B

I would want to make a circular iteration....

suggestions?

How about this:
x = ("A","B","C","D","E","F","G","H",)
offset = 2

for i in x[offset : ] + x[ : offset]:
    print i
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to