使用此代码可以解决python包导入路径问题?
作者:互联网
import sysimport os base = os.path.basename(__file__) #当前文件名base2 = os.path.abspath(__file__) #绝对路径base3 = os.path.dirname(os.path.abspath(__file__)) #当前文件路径base4 = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) #当前文件上级路径
标签:__,python,abspath,路径,导入,file,path,dirname,os 来源: https://blog.51cto.com/u_15177056/2725350