中打印語句的順序爲什麼第一個打印語句不給我'5 = 3'?這是John Guttag的書。不能讓我的頭靠近它。範圍混亂。無法解釋o/p
它看起來像這樣的方式:
3 = 4
2 = 4
1 = abc
4 = 4
5 = 3
6 = <function g at 0x026B22F0>
1 = abc
腳本:
def f(x):
def g():
x = 'abc'
print '1 =',x
def h():
z = x
print '2 =',z
x = x+1
print '3 =',x
h()
g()
print '4 =', x
return g
x = 3
z = f(x)
print '5 =',x
print '6 =',z
z()
修復您的縮進 – simonzack
它給您帶來了什麼? –