Possible Duplicate:
how can I iterate through two lists in parallel in Python?
我有三个清单:
name = ['sam', 'john', 'napoleon', 'tanaka', 'ming']
country = ['USA', 'England', 'France', 'Japan', 'China']
age = [23, 41, 19, 16, 55]
我想要这样的输出:
^{pr2}$
任何帮助都会很好。
提前谢谢
Tags:
假设列表长度相同:
更新:假设您使用的是python3.x。对于2.x,使用xrange来提高总体性能。或者:
^{pr2}$您可以使用
zip()
:或使用
^{pr2}$map()
:输出:
相关问题 更多 >
编程相关推荐