避免循环导入
一、模块内置变量
输入:
a = 2
c = 3
d = 5
infos = dir()
print(infos)
结果:
>>>
['__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'a', 'c', 'd']
在test.demo2中:
''' 这是注释'''
print(__name__)
print(__doc__)
print(__package__)
print(__file__)
运行结果:
__main__
这是注释
None
c:/Users/ablechen/.vscode/python/NO7/test/demo2.py
在demo7中:
import test.demo2
运行结果:
test.demo2
这是注释
test
c:\Users\ablechen\.vscode\python\NO7\test\demo2.py