changeDirectory.py
作者:互联网
import os
# change the current working directory from 'project\src\development' to 'project\volume\data\external'
def development2External(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
os.chdir(os.path.abspath('..'))
os.chdir(os.path.abspath('..\\volume\\data\\external'))
# change the current working directory from 'project\volume\data\external' to 'project\src\development'
def external2Development(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..\\src\\development'))
# change the current working directory from 'project\src\development' to 'project\volume\data\log'
def development2Log(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
os.chdir(os.path.abspath('..'))
os.chdir(os.path.abspath('..\\volume\\data\\log'))
# change the current working directory from 'project\volume\data\log' to 'project\src\development'
def log2Development(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..\\src\\development'))
# change the current working directory from 'project\src\development' to 'project\volume\data\raw'
def development2Raw(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
os.chdir(os.path.abspath('..'))
os.chdir(os.path.abspath('..\\volume\\data\\raw'))
# change the current working directory from 'project\volume\data\raw' to 'project\src\development'
def raw2Development(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..\\src\\development'))
# change the current working directory from 'project\src\development' to 'project\volume\data\Processed'
def development2Processed(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
os.chdir(os.path.abspath('..'))
os.chdir(os.path.abspath('..\\volume\\data\\Processed'))
# change the current working directory from 'project\volume\data\Processed' to 'project\src\development'
def processed2Development(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..\\src\\development'))
# change the current working directory from 'project\src\development' to 'project\volume\data\proof'
def development2Proof(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
os.chdir(os.path.abspath('..'))
os.chdir(os.path.abspath('..\\volume\\data\\proof'))
# change the current working directory from 'project\volume\data\proof' to 'project\src\development'
def proof2Development(naming = ""):
if naming != "":
scriptPath = getScriptPath(naming)
os.chdir(os.path.abspath(scriptPath))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..'))
# os.chdir(os.path.abspath('..\\src\\development'))
def getScriptPath(naming, rootLocal = "D:"):
return rootLocal + "\\DCG_PRF_Data_Team\\DataCleaning\\" + naming + "\\project\\src\\development"
标签:chdir,..,changeDirectory,abspath,py,path,naming,os 来源: https://www.cnblogs.com/zhulimin/p/15369440.html