好吧我正在做一些线程,我想当我开始做线程时我假设你不能返回像定义这样的值(它的结束时间和我的大脑即将死亡所以这可能是不正确的我应该开始去回去摆脱全局变量)
无论如何,我有一个测试程序来弄清楚为什么我不能模块化我的代码
一个名为config.py的文件
a_variable=0
Run Code Online (Sandbox Code Playgroud)
一个名为test_for_sean.py的文件
from config import *
def blah():
global a_variable
a_variable=14
return 0
Run Code Online (Sandbox Code Playgroud)
一个名为main.py的文件
from config import *
from test_for_sean import *
print a_variable #this prints correctly
blah()
print a_variable #this is still printing 0....
Run Code Online (Sandbox Code Playgroud)
有人把我联系起来,所以我不会自杀