Python iterator question

Posted by hdx on Stack Overflow See other posts from Stack Overflow or by hdx
Published on 2010-05-03T18:15:04Z Indexed on 2010/05/03 18:18 UTC
Read the original article Hit count: 525

Filed under:
|
|

I have this list:

names = ['john','Jonh','james','James','Jardel']

I want loop over the list and handle consecutive names with a case insensitive match in the same iteration. So in the first iteration I would do something with'john' and 'John' and I want the next iteration to start at 'james'.

I can't think of a way to do this using Python's for loop, any suggestions?

© Stack Overflow or respective owner

Related posts about python

Related posts about for-loop