Python3.5-20190529-os模块

 

os.getcwd()   获取当前路径
os.listdir("路径") 返回该路径下面所有的文件
os.path.abspath(path):返回path的绝对路径。
os.path.split(path):将路径分解为(文件夹,文件名)
os.path.join(path1,path2,...):将path进行组合.有点像字符串拼接
os.path.dirname(path):返回path中的文件夹部分,os.path.basename(path):返回path中的文件名。

 os.path.getmtime(path):文件或文件夹的最后修改时间,从新纪元到访问时的秒数。


 os.path.getatime(path):文件或文件夹的最后访问时间,从新纪元到访问时的秒数。


 os.path.getctime(path):文件或文件夹的创建时间,从新纪元到访问时的秒数。

os.path.exists(path):文件或文件夹是否存在,返回True 或 False。

 
 

 

posted @ 2019-05-29 23:37  Tarzen  阅读(217)  评论(0编辑  收藏  举报