import os
'''當前路徑 __file__ 與os.path.realpath(__file__) 路徑里面的斜杠方向不太一樣
例如:
__file__獲取到的路徑 G:/web_pro/ke4/t11.py
os.path.realpath(__file__)獲取到的路徑 G:\web_pro\ke4\t11.py
'''
#獲取當前路徑 G:\web_pro\ke4\t11.py
curpath = os.path.realpath(__file__)
#獲取當前路徑的上級路徑 G:\web_pro\ke4
dirpath = os.path.dirname(curpath)
#連接路徑 G:\web_pro\ke4\common\hello.xlsx
testpath = os.path.join(dirpath,'common','hello.xlsx')