我有字符串变量测试,在Python 2.7中,这工作正常。python 3输入字符串3
test = raw_input("enter the test") print test
但是在Python 3.3中。我用
test = input("enter the test") print test
与输入字符串sdas
,我得到一个错误信息
Traceback (most recent call last): File "/home/ananiev/PycharmProjects/PigLatin/main.py", line 5, in test = input("enter the test") File "", line 1, in NameError: name 'sdas' is not defined
你确定吗?据我了解,OP希望zu传递一个定义的变量,以便脚本确实评估该变量。 – reporter
你能详细说说你想说什么吗?如果你提供代码片段会更好? –