【发布时间】:2021-07-05 06:50:05
【问题描述】:
test.py
asd = ''
def upd():
asd = 'Anything'
def hello():
upd()
print('hello')
return asd
script.py
import test as tt
print(tt.hello())
如何在 script.py 中获取更新的 'asd' 值? 有人请建议
【问题讨论】:
-
没有更新
asd;test.asd是一个完全不同于upd函数定义的 local 变量asd的变量。
标签: python python-3.x variables import