Discuss / Python / 参考源码do_input.py运行不了呢?

参考源码do_input.py运行不了呢?

Topic source

参考源码do_input.py运行不了呢?

是的,我也发现了这个问题,怀疑是不是版本差异的问题。

输入名字时会有这样的报错: YONDONG-M-L2QT:desktop yondong$ python study.py Please enter your name:Yong Dong Traceback (most recent call last): File "study.py", line 1, in <module> name=input('Please enter your name:') File "<string>", line 1 Yong Dong ^ SyntaxError: unexpected EOF while parsing

加引号输入就可以正常运行啦 YONDONG-M-L2QT:desktop yondong$ python study.py Please enter your name:'Yong Dong' ('Hello,', 'Yong Dong')

================================================================== 稍微改一下代码显示更好些: name=input('Please enter your name:') print('Hello,') print(name)

输出如下: YONDONG-M-L2QT:desktop yondong$ python study.py Please enter your name:'Yong Dong' Hello, Yong Dong


  • 1

Reply