我是一個Python newbie.I正在逐漸熟悉環和一本書蟒蛇輸入()無法正常運行
while True:
s = input('Enter something : ')
if s == 'quit':
break
print('Length of the string is', len(s))
print('Done')
然而,輸出如下
Enter something : ljsdf
Traceback (most recent call last):
File "trial_2.py", line 2, in <module>
s = input('Enter something : ')
File "<string>", line 1, in <module>
NameError: name 'ljsdf' is not defined
爲它的價值:這基本上是http://stackoverflow.com/q/11295325/的副本748858雖然你可能無法找到它,如果你不知道在哪裏看... – mgilson