1、使用os.chdir命令,下面是返回上上级目录的命令
os.chdir('../..')
2、返回后需要确认目录,打印目录出来,命令如下:
import os
currentPath = os.getcwd().replace('\\','/') # 获取当前路径
print(currentPath)
1、使用os.chdir命令,下面是返回上上级目录的命令
os.chdir('../..')
2、返回后需要确认目录,打印目录出来,命令如下:
import os
currentPath = os.getcwd().replace('\\','/') # 获取当前路径
print(currentPath)