python - perform multiple for loops simultaneously -


Is it possible to do several loops together in Python? Like

(syntax error, of course):

 for  list_of_a, list_of_b: // some work   

< Em> Together , I

I mean, they share the same index or cursor during the repetition.

What can I think about getting this:

  1. Use a shared cursor as a shared cursor
  2. Put them in the list of topleples and repeat the list but it is painful to make a list

    I'm just thinking that to get some underlying work or simple syntax in it.

    B, in zip (list_of_a, list_of_b): # some work

    If you are using Python 2.x, are concerned about the performance, and / or use iterators instead of the list, instead consider.

    In Python 3.x, it replaces itertools.izip ; Use list (zip (..) to get an old (2.x) behavior of zip

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -