现在的位置: 首页 > 综合 > 正文

python严格的命名冲突

2018年03月22日 ⁄ 综合 ⁄ 共 112字 ⁄ 字号 评论关闭

for str in ls:

     print str

print str(1)

大家可以看到有什么错误吗?

提示是str is not callable

这是因为在上面的局部变量中有str这个局部变量,所以在定义变量时一定要注意,不要和内建函数冲突

抱歉!评论已关闭.