Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foo = (1, 2, 3)
- bar = (4, 5, 6)
- for (f, b) in some_iterator(foo, bar):
- print "f: ", f, "; b: ", b
- f: 1; b: 4
- f: 2; b: 5
- f: 3; b: 6
- for i in xrange(len(foo)):
- print "f: ", foo[i], "; b: ", b[i]
- for f, b in zip(foo, bar):
- print(f, b)
- import itertools
- for f,b in itertools.izip(foo,bar):
- print(f,b)
- for f,b in itertools.izip_longest(foo,bar):
- print(f,b)
- for num, cheese, color in zip([1,2,3], ['manchego', 'stilton', 'brie'],
- ['red', 'blue', 'green']):
- print('{} {} {}'.format(num, color, cheese))
- 1 red manchego
- 2 blue stilton
- 3 green brie
- for (f,b) in zip(foo, bar):
- print "f: ", f ,"; b: ", b
- def custom_zip(seq1, seq2):
- it1 = iter(seq1)
- it2 = iter(seq2)
- while True:
- yield next(it1), next(it2)
- #value1 is a list
- value1 = driver.find_elements_by_class_name("review-text")
- #value2 is a list
- value2 = driver.find_elements_by_class_name("review-date")
- for val1 in value1:
- print(val1.text)
- print "n"
- for val2 in value2:
- print(val2.text)
- print "n"
- for val1, val2 in zip(value1,value2):
- print (val1.text+':'+val2.text)
- print "n"
Add Comment
Please, Sign In to add comment