我是一个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