python获取当前目录及其父目录
import os
current_directory = os.getcwd()
parent_directory = os.path.dirname(current_directory)
print("当前目录:", current_directory)
print("上一级目录:", parent_directory)
import os
current_directory = os.getcwd()
parent_directory = os.path.dirname(current_directory)
print("当前目录:", current_directory)
print("上一级目录:", parent_directory)