# __file__ #表示文件的名字 # os.path.abspath(__file__) #绝对路径 #软件运行的所在文件夹目录--根目录 BASEDIR=os.path.dirname(os.path.abspath(__file__)) pathfile=os.path.join(BASEDIR,'config','config.ini') # print(pathfile)
# __file__ #表示文件的名字 # os.path.abspath(__file__) #绝对路径 #软件运行的所在文件夹目录--根目录 BASEDIR=os.path.dirname(os.path.abspath(__file__)) pathfile=os.path.join(BASEDIR,'config','config.ini') # print(pathfile)
在程序中我们通过‘os.path.join(BASEDIR,'config','config.ini')’去合成我们需要的文件路径



