#a.py
class Test():
def __init__(self):
self.value = 10
def output(self):
return self.value
t = Test()
print(t.value)
#b.py 只有这一个导入,没别的东西
from a import Test
运行 b.py 时会输出 a.py 中 t.value 的值,即 10 , 这是什么原因?
class Test():
def __init__(self):
self.value = 10
def output(self):
return self.value
t = Test()
print(t.value)
#b.py 只有这一个导入,没别的东西
from a import Test
运行 b.py 时会输出 a.py 中 t.value 的值,即 10 , 这是什么原因?