zoukankan      html  css  js  c++  java
  • 查看文件属性

    import  glob
    import  os
    import  time
    os.chdir("E:pdf")
    所有文件=glob.glob(r'**/*.pdf',recursive=True)
    
    #查看文件属性
    for  i in 所有文件:
        文件大小=os.stat(i).st_size/1024/1024
        时间=time.localtime(os.stat(i).st_ctime)
        日期=time.strftime("%Y-%m-%d",时间)
        print("文件路径{},文件大小{}MB,创建时间{}
    ".format(i,round(文件大小,2),日期))

    文件路径1.pdf,文件大小0.45MB,创建时间2020-07-15

    文件路径2.pdf,文件大小0.36MB,创建时间2020-07-15

    文件路径3.pdf,文件大小0.32MB,创建时间2020-07-15

    文件路径4.pdf,文件大小0.35MB,创建时间2020-07-15

    文件路径Python 100例 _ 菜鸟教程.pdf,文件大小0.38MB,创建时间2020-07-13

    文件路径python.pdf,文件大小0.56MB,创建时间2020-07-13

    文件路径合并后的pdf文件.pdf,文件大小1.47MB,创建时间2020-07-14

    文件路径旋转.pdf,文件大小0.45MB,创建时间2020-07-15

    文件路径旋转_1.pdf,文件大小0.5MB,创建时间2020-07-15

    文件路径给页码排序.pdf,文件大小0.57MB,创建时间2020-07-15

    文件路径表格.pdf,文件大小0.12MB,创建时间2020-07-13

  • 相关阅读:
    select选中值传递到后台action中
    select into from 与insert into select from区别
    存储过程
    layer
    下拉框两级联动
    无限纠结——Zedboard上跑ubuntu详解
    静态时序分析SAT
    设计模式-(构型模式)
    内存断点调试的原理
    C语言中使用静态函数的好处
  • 原文地址:https://www.cnblogs.com/luckiness/p/13305693.html
Copyright © 2011-2022 走看看