2019-02-26
阅读量:
966
python 中map函数报错
python 中map函数报错:报错信息如下

答:这是参数传错导致的,map函数的第二个参数需要是可迭代的,map函数的文档做了如下介绍
Docstring:
map(function, sequence[, sequence, ...]) -> list
Return a list of the results of applying the function to the items of
the argument sequence(s). If more than one sequence is given, the
function is called with an argument list consisting of the corresponding
item of each sequence, substituting None for missing values when not all
sequences have the same length. If the function is None, return a list of
the items of the sequence (or a list of tuples if more than one sequence).
Type: builtin_function_or_method
其中function位置需要传入函数,后面的可以传入一个或多个序列类型的参数,如列表、字典、元组等






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论