Python中改变当前工作目录

import os
os.getcwd() # 查看当前工作目录
os.chdir(“D:\\Python\\some_other_directory”) # 改变目录,注意双引号和反斜杠

顺便推荐一下Dreampie这个Python编辑器,非常好用

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s