python同时遍历两个list

python同时遍历两个list

list1 = ['a', 'b', 'c', 'd']
list2 = ['apple', 'boy', 'cat', 'dog']
for x, y in zip(list1, list2):
  print(x, y)
注:两个列表等长

 
 

猜你喜欢

转载自www.cnblogs.com/Sakurar/p/12723903.html