python 切换工作目录
切换到指定名字的目录,作为init文件,在别的文件中import该文件就可以完成切换目录
# 切换工作目录 import os current_path = os.getcwd() print(current_path) project_name = ‘project‘ current_path = current_path[:current_path.find(project_name) + len(project_name)] os.chdir(current_path) print(os.getcwd())
相关推荐
旭灿 2020-09-30
WenCoo 2020-09-16
TuxedoLinux 2020-08-28
hongsheyoumo 2020-08-19
wintelx 2020-08-09
insularisland 2020-08-09
cwgxiaoguizi 2020-08-09
benico 2020-07-28
nebulali 2020-07-26
chenkai00 2020-07-26
tengyuan 2020-07-26
zhongcanw 2020-07-25
89590098 2020-07-19
dongfangxiaozi 2020-07-19
学峰的学习笔记 2020-07-18
深井兮兮 2020-07-18
NeverAgain 2020-07-06