被搞得头疼,已经放弃试图理解它的运行机制了..
请预测以下脚本的运行结果:
========================
'文件a'
exec('a = 1')
print(a)
========================
'文件b'
def f():
exec('a = 1')
print(a)
f()
========================
'文件c'
a = 1
exec('a = 2')
print(a)
========================
'文件d'
def f():
a = 1
exec('a = 2')
print(a)
========================
--
修改:annals FROM 61.149.74.61
FROM 61.149.74.61