Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

iterate through 2 strings python

# Python 3
for f, b in zip(foo, bar):
    print(f, b)

# Python 2
import itertools
for f, b in itertools.izip(foo, bar):
    print(f,b)
    
# zip and izip stop when the shorter of foo or bar stops.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #iterate #strings #python
ADD COMMENT
Topic
Name
9+5 =