请大神帮忙看这段代码问题
python3为何运行出错
python3为何运行出错
2018-06-30
python2的help(map)
Help on built-in function map in module __builtin__:
map(...)
map(function, sequence[, sequence, ...]) -> list
Return a list of。。。。
python3的help(map)
Help on class map in module builtins:
class map(object)
| map(func, *iterables) --> map object
所以python3的map返回的是一个object,可以用list()转型
最后的print语句改为:
n_lst = map(fromat_name,['adam','Lisa','barT'])
print(list(n_lst))
举报