品易云推流 关闭
文章详情页
文章 > Python常见问题 > python如何设置路径

python如何设置路径

头像

(*-*)浩

2019-08-30 13:26:0315443浏览 · 0收藏 · 0评论

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

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

默认路径为:

>>> import os
>>> os.getcwd()

'D:\\Program Files\\Python35

跳转到当前工作路径为

>>> os.chdir("D:\Program Files\Python35\modifyPath\test02")
>>> os.getcwd()

'D:\\Program Files\\Python35\\ modifyPath \\ test02
关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

底部广告图