我是如何克服python中的名称错误的
我写了下面的代码,但在运行过程中“raw_input”中出现了名称错误,请帮助我解决这个问题 我的代码是:我是如何克服python中的名称错误的,python,file,compiler-errors,namespaces,raw-input,Python,File,Compiler Errors,Namespaces,Raw Input,我写了下面的代码,但在运行过程中“raw_input”中出现了名称错误,请帮助我解决这个问题 我的代码是:fname=raw\u input('输入文件名:') 打印(fname) Error is=name Error:name'raw\u input'不是在python 3+上定义的raw\u input现在只是input() 您正在使用Python3,其中raw\u input现在已更改为简单的input,看起来您在不存在raw\u input的情况下使用Python3。将其替换为inpu
fname=raw\u input('输入文件名:')
打印(fname)
Error is=name Error:name'raw\u input'不是在python 3+上定义的
raw\u input
现在只是input()
您正在使用Python3,其中
raw\u input
现在已更改为简单的input
,看起来您在不存在raw\u input
的情况下使用Python3。将其替换为input
或切换回Python 2。
fname = input('Enter a file name: ')
print(fname)