获取当前目录,上级目录,上上级目录
import os
print('当前目录')
print(os.getcwd())
print('上级目录')
print(os.path.dirname(file_path))
print('上上级目录‘)
print(os.path.dirname(os.path.dirname(file_path)))
import os
print('当前目录')
print(os.getcwd())
print('上级目录')
print(os.path.dirname(file_path))
print('上上级目录‘)
print(os.path.dirname(os.path.dirname(file_path)))