python获取绝对路径

import os

absolute_path = os.path.abspath(__file__)
print(absolute_path)

dir_name = os.path.dirname(absolute_path)
print(dir_name)



import inspect

absolute_path = inspect.getfile(inspect.currentframe())
print(absolute_path)

dir_name = os.path.dirname(absolute_path)
print(dir_name)

上一篇:border小于1px


下一篇:position定位的属性