Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我是如何克服python中的名称错误的_Python_File_Compiler Errors_Namespaces_Raw Input - Fatal编程技术网

我是如何克服python中的名称错误的

我是如何克服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

我写了下面的代码,但在运行过程中“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。将其替换为
input
或切换回Python 2。
fname = input('Enter a file name: ')
print(fname)