首页 > 编程语言 > 详细

Python标准库os

时间:2014-10-28 21:27:00      阅读:282      评论:0      收藏:0      [点我收藏+]

如果你希望自己的程序能够与平台无关的话,这个模块至关重要

 

os.name #‘nt‘ for windows, ‘posix‘ for linux/unix

os.getcwd() #get current work directory,即Python脚本工作的目录路径

os.getenv() #get the environment variables

os.setenv() #set the ...

os.listdir(mdir) #list all files and directories name under mdir

os.remove(mfile) #delete mfile

os.system() #run shell command

os.linesep #行终止符, ‘\r\n‘ for windows, ‘\n‘ for linux, ‘\r‘ for mac

os.path.split(mpath) #return (directory,filename)

os.path.isfile(mstr)
os.path.isdir(mstr)
os.path.existe(mdir) # if the mdir exist

 

Python标准库os

原文:http://www.cnblogs.com/magnolia/p/4057893.html

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