在我的自制代碼中遇到了一些麻煩。 def even(a, b):
f = []
while a <= b:
if a % 2 == 0:
f.append(a)
a = a + 1
return f;
當我試着從上面說的殼叫它: Traceback (most recent call last):
File "<pyshel
class Gui():
var = None
def refreshStats(args):
print(str(var))
clas = Gui()
clas.refreshStats()
跟蹤 File "sample.py", line 5, in refreshStats
print(str(var))
NameError: name
請看下面的input()調用是如何處理的。我究竟做錯了什麼? > python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more informatio