Changeset 391 for python/trunk/Doc/library/glob.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/library/glob.rst
r2 r391 1 2 1 :mod:`glob` --- Unix style pathname pattern expansion 3 2 ===================================================== … … 9 8 .. index:: single: filenames; pathname expansion 10 9 10 **Source code:** :source:`Lib/glob.py` 11 12 -------------- 13 11 14 The :mod:`glob` module finds all the pathnames matching a specified pattern 12 15 according to the rules used by the Unix shell. No tilde expansion is done, but … … 14 17 matched. This is done by using the :func:`os.listdir` and 15 18 :func:`fnmatch.fnmatch` functions in concert, and not by actually invoking a 16 subshell. (For tilde and shell variable expansion, use 17 :func:`os.path.expanduser` and :func:`os.path.expandvars`.) 19 subshell. Note that unlike :func:`fnmatch.fnmatch`, :mod:`glob` treats 20 filenames beginning with a dot (``.``) as special cases. (For tilde and shell 21 variable expansion, use :func:`os.path.expanduser` and 22 :func:`os.path.expandvars`.) 23 24 For a literal match, wrap the meta-characters in brackets. 25 For example, ``'[?]'`` matches the character ``'?'``. 18 26 19 27 … … 47 55 ['1.gif'] 48 56 57 If the directory contains files starting with ``.`` they won't be matched by 58 default. For example, consider a directory containing :file:`card.gif` and 59 :file:`.card.gif`:: 60 61 >>> import glob 62 >>> glob.glob('*.gif') 63 ['card.gif'] 64 >>> glob.glob('.c*') 65 ['.card.gif'] 49 66 50 67 .. seealso::
Note:
See TracChangeset
for help on using the changeset viewer.