惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
Google Developers Blog
T
Threat Research - Cisco Blogs
Cyberwarzone
Cyberwarzone
罗磊的独立博客
S
Security Affairs
D
Docker
Microsoft Azure Blog
Microsoft Azure Blog
G
GRAHAM CLULEY
W
WeLiveSecurity
博客园 - Franky
C
Check Point Blog
The Last Watchdog
The Last Watchdog
F
Full Disclosure
Security Latest
Security Latest
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
AWS News Blog
AWS News Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Troy Hunt's Blog
S
Secure Thoughts
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Privacy & Cybersecurity Law Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy International News Feed
S
Schneier on Security
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tenable Blog
aimingoo的专栏
aimingoo的专栏
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Recent Announcements
Recent Announcements
IT之家
IT之家
D
DataBreaches.Net
U
Unit 42
博客园 - 聂微东
H
Hacker News: Front Page
GbyAI
GbyAI
T
The Exploit Database - CXSecurity.com
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
TaoSecurity Blog
TaoSecurity Blog
Google Online Security Blog
Google Online Security Blog
T
Threatpost
博客园 - 叶小钗
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
K
Kaspersky official blog

博客园 - zzuCharles

Qwen-Max 8G 内存本地部署方案(轻量化可用版) MFC中使用多线程 高性能 Flink SQL 优化 Flink 时间概念 EventTime 和 Watermark SQL 优化(来源平时总结及网络分享) hadoop 查询优化 python 读取csv多编码兼容读取 文件拆分-python Mysql 调优笔记 Python 输出菱形 Python 猜数小程序(练习) Mysql 字符串日期互转 MaxCompute 语句笔记 数据仓库架构 Python 比较两个字符串的相似度 Python print Python简单计算器 用户价值模型 CITE :https://www.jianshu.com/p/34199b13ffbc 用户生命周期模型
Python 读取目录,office文件分类
zzuCharles · 2020-05-21 · via 博客园 - zzuCharles
import os
dict_suffix   ={'doc':[],'docx':[],
          'xls':[],'xlsx':[],
          'ppt':[],'pptx':[]}

def lsdir(path):
    for dirpath,dirnames,filenames in os.walk(path):
        for filename in filenames:  
            suffix=filename[filename.rfind(r'.')+1:len(filename)].lower() 
            if suffix in dict_suffix:
                dict_suffix[suffix].append(os.path.join(dirpath,filename))
    return  dict_suffix
      
  
        

if __name__ == '__main__': 
   # pl = r'D:\workspace\数据字典'
    old_pl=input('请输入路径:')
    if old_pl[-1] =='\/':
        old_pl=old_pl[0:len(old_pl)-1]
    pl=old_pl.replace('\/', '\/\/')
    dic=lsdir(pl)
    for i in dic:
        if len(dic[i])>0 :
            print('文件类型:',i)
            [print(s) for s in dic[i]]