for x in y, type iteration in python. Can I find out what iteration I'm currently on?
Posted
by foo
on Stack Overflow
See other posts from Stack Overflow
or by foo
Published on 2010-05-24T01:34:05Z
Indexed on
2010/05/24
1:40 UTC
Read the original article
Hit count: 247
Hi,
I have a question about the loop construct in Python in the form of: for x in y:
In my case y is a line read from a file and x is separate characters. I would like to put a space after every pair of characters in the output, like this: aa bb cc dd
etc. So, I would like to know the current iteration. Is it possible, or do I need to use a more traditional C style for loop with an index?
© Stack Overflow or respective owner