python_glob模块的使用
2014-05-25 15:24
399 查看
转载:http://www.verydemo.com/demo_c122_i15114.html
glob是python自己带的一个文件操作相关模块,用它可以查找符合自己目的的文件,就类似于Windows下的文件搜索,支持通配符操作,*,?,[]这三个通配符,*代表0个或多个字符,?代表一个字符,[]匹配指定范围内的字符,如[0-9]匹配数字。
它的主要方法就是glob,该方法返回所有匹配的文件路径列表,该方法需要一个参数用来指定匹配的路径字符串(本字符串可以为绝对路径也可以为相对路径),。
python手机中的介绍:
The module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell. No tilde expansion is done, but,
, and character ranges expressed with
will be correctly matched. This is done by using the and functions in concert, and not by actually invoking a subshell. (For tilde and shell variable expansion, use
and.)
glob.glob(pathname) #返回列表Return a possibly-emptyof path names that matchpathname, which must be a string containing a path specification.
pathname can be either absolute (like) or relative (like), and can contain shell-style wildcards.…………………………………………………………………………
glob是python自己带的一个文件操作相关模块,用它可以查找符合自己目的的文件,就类似于Windows下的文件搜索,支持通配符操作,*,?,[]这三个通配符,*代表0个或多个字符,?代表一个字符,[]匹配指定范围内的字符,如[0-9]匹配数字。
它的主要方法就是glob,该方法返回所有匹配的文件路径列表,该方法需要一个参数用来指定匹配的路径字符串(本字符串可以为绝对路径也可以为相对路径),。
python手机中的介绍:
The module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell. No tilde expansion is done, but,
, and character ranges expressed with
will be correctly matched. This is done by using the and functions in concert, and not by actually invoking a subshell. (For tilde and shell variable expansion, use
and.)
glob.glob(pathname) #返回列表Return a possibly-emptyof path names that matchpathname, which must be a string containing a path specification.
pathname can be either absolute (like) or relative (like), and can contain shell-style wildcards.…………………………………………………………………………
相关文章推荐
- 使用glob模块,遍历E盘下的mp3文件 分类: python 小练习 2013-05-15 15:40 405人阅读 评论(0) 收藏
- 在Python中使用glob模块查找文件路径的方法
- python_glob模块的使用
- 使用glob模块输出目录内容 分类: python 小练习 2013-09-17 18:16 248人阅读 评论(0) 收藏
- Python 中glob模块使用笔记
- 在Python中使用glob模块查找文件路径的方法
- python中的glob模块函数:glob,iglob和escape的使用
- 今天犯了一个很蠢的错误,有关python的模块包的使用的
- 在Python 中使用模块和类
- python模块之threading: 在python中使用多线程
- PYTHON正则表达式 re模块使用说明
- Python的内存泄漏及gc模块的使用
- Python:使用getopt模块处理命令行参数
- 使用Visual Studio 6.0 (C/C++)开发Python扩展模块
- 使用Python的timeit模块
- python 模块使用
- [转]可爱的 Python:: 使用 itertools 模块中的组合函数
- Base64 编码原理简介和python的base64模块的使用
- Python相关模块学习1 处理文件名模块glob
- Python相关模块学习1 处理文件名模块glob