Python 模块中的一些全局变量

__name__    如果是主文件__name__=='__main__' 否则等于模块名
__file__    当前文件路径 
__package__ 当前文件所在包,用 . 分割      
__doc__     py文件的注释
__cached__  缓存
__loader__  
__builtins__
__spec__

import sys,os path=os.path.dirname(__file__) file='bin' fp=os.path.join(path,file) sys.path.append(fp)
原文地址:https://www.cnblogs.com/ezway/p/6514816.html