"Ole Henning Jensen" <[EMAIL PROTECTED]> wrote
> What you need to do is loop all the way through your list and then
> only
> do something to every third element in the list
That's not quite what the OP asked for, he wanted the third
element from every sublist in the master list
> This is an example of a for loop, that prints out every 3 element:
You can do this using slicing, no need for a for loop
L = range(10)
print L{2::3]
the 2 is the start position - the 3rd element, then the
final 3 is the step size, giving every third element up
to the end of the list.
Interesting maybe, but not what the OP asked for.
--
Alan Gauld
Author of the Learn to Program web site
Temorarily at:
http://uk.geocities.com/[EMAIL PROTECTED]/
Normally:
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor