- a_list = ['a', 'b', 'c', 'd', 'e']
- b_list = ['A', 'B', 'C', 'D', 'E']
- zipped = zip(a_list, b_list)
- for x, y in zipped:
- print x, y # a, Aという組み合わせでe, Eまで表示される
こんな感じで簡単に使えるなんて、やっぱりPythonサイコー。
ほぼ毎日「午前様」で帰宅するWorkaholicのメモサイト。
a_list = ['a', 'b', 'c', 'd', 'e']
b_list = ['A', 'B', 'C', 'D', 'E']
zipped = zip(a_list, b_list)
for x, y in zipped:
print x, y # a, Aという組み合わせでe, Eまで表示される
No comments:
Post a Comment