-
习惯了linux下面的cd、pwd、等等这样便捷的改变工作目录的函数了吧,现在在python的命令行IDLE或者说是Python Shell里面如何实现呢?
下面的两个个函数就可帮你实现了。
os.
chdir
(
path
)
-
Change the current working directory to path.
Availability: Unix, Windows.
-
os.
getcwd
(
)
-
Return a string representing the current working directory.
Availability: Unix, Windows.
os.chdir("D:\\STUDY\\JAVA\\workplace\\helios\\PyTest\\test") >>> os.getcwd <built-in function getcwd> >>> os.getcwd() 'D:\\STUDY\\JAVA\\workplace\\helios\\PyTest\\test'