pyhon获取路径
当前文件所在目录:
os.path.dirname(__file__)
当前文件的路径:
os.path.abspath(os.path.basename(__file__))
增加路径:
service_dir=join(dirname(dirname(abspath(__file__))), 'service')
sys.path.append(serivce_dir)
当前文件名:
os.path.basename(__file__)
当前的文件的执行路径:
print(os.getcwd())
print(os.path.abspath('.'))
print(os.path.abspath(os.curdir))
---当才华撑不起你的野心的时候,请努力!---跑起来。
浙公网安备 33010602011771号