Код: Выделить всё
myuser$ cat r2.py
#!/usr/bin/env python
def newdef():
a = input('say yes\n')
if a == 'yes':
print('he said yes')
else:
print('he said something else')
newdef()
Код: Выделить всё
myuser$ ./r2.py
say yes
yes
Traceback (most recent call last):
File "./r2.py", line 11, in
newdef()
File "./r2.py", line 4, in newdef
a = input('say yes\n')
File "", line 1, in
NameError: name 'yes' is not defined
myuser$
Подробнее здесь: https://stackoverflow.com/questions/495 ... ed-as-file
Мобильная версия