【发布时间】:2019-09-27 15:10:45
【问题描述】:
代码:
print("Starting...")
def test():
notare = input()
bote()
def bote():
if notare == "a":
print("b")
else:
print("c")
test()
错误:
Traceback (most recent call last):
File "test.py", line 13, in <module>
test()
File "test.py", line 5, in test
bote()
File "test.py", line 8, in bote
if notare == "a":
NameError: name 'notare' is not defined
【问题讨论】:
-
正确;
notare未定义。你的问题是为什么它没有被定义,还是你想要一些解决方法以便它是在bote中定义的? -
问题是你还没有在你的
bote函数中定义notare是什么。您需要将它作为变量传递给bote。此外,这是一个非常基本的问题,您没有付出任何努力。仅仅粘贴你的代码和错误信息不会让人很乐意帮助你..
标签: python python-3.x list python-requests