【发布时间】:2012-06-11 03:47:52
【问题描述】:
以下示例显示了我尝试在函数调用中使用字符串函数来映射时遇到的错误。我需要帮助了解为什么会发生这种情况。谢谢。
>>> s=["this is a string","python python python","split split split"]
>>> map(split,s)
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
map(split,s)
NameError: name 'split' is not defined
虽然split()是一个内置函数,但还是会抛出这个错误?
【问题讨论】:
标签: python string map python-3.x