Python使用'input'读取输入文本出现NameError错误
来源:互联网 发布:想做淘宝客服兼职 编辑:程序博客网 时间:2024/06/04 07:41
在Python2.7中内置函数input()会将输入数据当成指令,从键盘中输入数据应该使用raw_input()
在Python3中input()函数用于从键盘中读取数据
1 #!/usr/bin/python 2 # -*- coding: utf-8 -*- 3 4 # 使用 input 会出现NameError 5 message = input("Tell me something, and I will repeat it back to you!\n>") 6 # message = raw_input("Tell me something, and I will repeat it back to you!\n>") 7 print(message)
Tell me something, and I will repeat it back to you!>HelloTraceback (most recent call last): File "./abc.py", line 5, in <module> message = input("Tell me something, and I will repeat it back to you!\n>") File "<string>", line 1, in <module>NameError: name 'Hello' is not defined
阅读全文
1 0
- Python使用'input'读取输入文本出现NameError错误
- python错误之NameError
- 使用python经常出现NameError: name 'xxx' is not defined
- Python 读取输入 input 和raw_input
- 读取json文本出现解析错误
- Python 读取键盘输入 :raw_input()和input() 函数 读取交互输入
- 使用python读取txt文本
- NGUI输入文本Input
- Python使用Tkinter错误,NameError: global name 'TOP' is not defined
- Python raw_input()和input() 函数 读取交互输入
- python input输入函数
- Python编译时提示“NameError: name 'Popen' is not defined”及”NameError: name 'PIPE' is not defined“错误的解决
- python中input输入时使用方向键的问题
- Python文本读取笔记
- AJAX实时读取输入文本
- 使用input读取文件
- html禁止清除input文本输入缓存
- text文本输入表单input和textarea
- c++加载驱动文件
- Hive简单部署
- 如何为eclipse安装合适版本的python插件pydev
- 使用eclipse作为python开发工具安装旧版pydev
- 脚本题
- Python使用'input'读取输入文本出现NameError错误
- Wall POJ
- Activity知识点,一篇搞定!
- deepin zsh 出现" chsh: PAM: 鉴定故障 " 解决方法
- C# 自定义控件(一)
- visual studio自动补全unity组件拼写设置
- pygame编写飞机大战(4)-滚动地图
- Angularjs编写选项卡
- vue.js图片无法显示问题总结