加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

python报错:str=input()File"<string>",line1,in<module>NameError:namehelloi

(2018-09-19 17:27:13)
简单程序:
message = input("Tell me something, and I will repeat it back to you: ")
print(message)

运行时,发现只能输入数字,输入字符串时即报上面的错误。


原因:
python版本问题

python3的语法,但是自己电脑时python2.7

input 改为 raw_input


0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有