zip()函数:将多个序列“压缩”成一个元组序列。
names= ['Tom', 'Jerry', 'Mike'] ages= [18, 20, 22] forname, ageinzip(names, ages): print(name, age) # 输出:# Tom 18# Jerry 20# Mike 22
zip()函数:将多个序列“压缩”成一个元组序列。
names= ['Tom', 'Jerry', 'Mike'] ages= [18, 20, 22] forname, ageinzip(names, ages): print(name, age) # 输出:# Tom 18# Jerry 20# Mike 22