设为首页收藏本站

Crossin的编程教室

 找回密码
 立即加入
楼主: crossin先生
打印 上一主题 下一主题

【每日一坑 4】 查找文件

[复制链接]

0

主题

0

好友

26

积分

新手上路

Rank: 1

楼主
发表于 2017-1-21 16:36:04 |显示全部楼层
import os

for path,dirs,files in os.walk("指定文件夹"):
    for file in files:
        if file.endswith(".txt"):
            print(os.path.join(path,file))


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

QQ|手机版|Archiver|Crossin的编程教室 ( 苏ICP备15063769号  

GMT+8, 2024-5-3 17:54 , Processed in 0.023623 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部