56游戏网 - 努力做内容最丰富最安全的下载站!

56游戏网

当前位置:56游戏 > 源码技巧 > 父类数据 > python列出目录下指定文件与子目录的方法

python列出目录下指定文件与子目录的方法

发表时间:2015-07-03 11:31:49作者:zhao人气:更新时间:2026-02-18 20:07:03

本文实例讲述了python列出目录下指定文件与子目录的方法。分享给大家供大家参考。具体实现方法如下:

# if you know the exact name:

import os

files = os.listdir('/path/to/dir/')

# if you want shell-style globbing:

import glob

files = glob.glob('/path/to/dir/*.html')

希望本文所述对大家的Python程序设计有所帮助。
 

标签python,列出,录下,指定,文件,子目录,方法,本文,实

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

公众号