首页 > 其他 > 详细

os.path 模块

时间:2018-12-13 15:51:45      阅读:179      评论:0      收藏:0      [点我收藏+]
import os
import time

# os.path 获取文件属性

# file = ‘ped.png‘
# print(os.path.abspath(file))
#
#
# print(os.path.getctime(file))      # os.path.getctime() 获取文件创建时间
# print(os.path.getatime(file))      # os.path.getatime() 文件最近访问时间
# print(os.path.getmtime(file))      # os.path.getmtime() 文件最近修改时间
#
# print(time.gmtime(os.path.getmtime(file)))
# print(os.path.getsize(file))
# print(os.path.normpath(file))


file = C:/learn/note.txt
print(os.path.basename(file))
print(os.path.dirname(file))
print(os.path.split(file))
print(os.path.join(root,test,a.txt))

os.path 模块的程序可以是遍地可见了。

参考:http://www.runoob.com/python3/python3-os-path.html

os.path 模块

原文:https://www.cnblogs.com/TreeDream/p/10114031.html

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