Pythonは2つのリストを同時にトラバースします

Pythonは2つのリストを同時にトラバースします

list1 = ['a'、 'b'、 'c'、 'd']
list2 = ['apple'、 'boy'、 'cat'、 'dog']
for x、y in zip(list1、list2):
  print(x、y)
注:2つのリストは同じ長さです

 

 
 

おすすめ

転載: www.cnblogs.com/Sakurar/p/12723903.html