作者:青锋寒万岁 | 来源:互联网 | 2023-10-10 11:27
如下面这段代码,我想把map和zip做出同样的效果
1 2 3 4 5 6 7
| name=['a','b','c']
age=[10,11,12]
nation=['中国','にほん','Deutsch']
U1=list(zip(name,age,nation))
print(U1)
U2=map(None,name,age,nation)
print(list(U2)) |
可是显示:
1 2 3 4 5
| [('a', 10, '中国'), ('b', 11, 'にほん'), ('c', 12, 'Deutsch')]
Traceback (most recent call last):
File "F:/python/PT/program/nine neijian3.py", line 8, in
print(list(U2))
TypeError: 'NoneType' object is not callable |
但是我去掉map里面的None:
1 2
| U2=map(name,age,nation)
print(list(U2)) |
显示:
1 2
| print(list(U2))
TypeError: 'list' object is not callable` |
请各位大神赐教。