>>os.getcwd()D:\\ProgramFiles\\Py"/>

python如何设置路径

改变python的默认路径为当前的工作路径

通过os模块来进行python中路径的更改

默认路径为:

>>>importos

>>>os.getcwd()

'D:\\ProgramFiles\\Python35

跳转到当前工作路径为

>>>os.chdir("D:\ProgramFiles\Python35\modifyPath\test02")

>>>os.getcwd()

'D:\\ProgramFiles\\Python35\\modifyPath\\test02

以上内容为大家介绍了python培训之如何设置路径,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注我们

推荐阅读