首页 > 编程语言 > 详细

Python IDLE或shell中切换路径

时间:2018-10-05 13:05:48      阅读:192      评论:0      收藏:0      [点我收藏+]
Python IDLE或shell中切换路径

在Python自带的编辑器IDLE中或者Python shell中不能使用cd命令,需要os模块的相关函数来操作。

具体如下:

import os  
os.getcwd() #获取当前路径  
os.chdir("D:\\test") #跳到目标路径下  
os.chdir(D:\\test) #单引号、双引号都可以

 

Python IDLE或shell中切换路径

原文:https://www.cnblogs.com/keep-pure/p/9744445.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!