Merged revisions 75039 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75039 | ezio.melotti | 2009-09-24 00:36:39 +0300 (Thu, 24 Sep 2009) | 1 line

  improved phrasing, markup and example
........
This commit is contained in:
Ezio Melotti 2009-09-23 21:39:50 +00:00
parent 2697ff2a87
commit c24d035e9b
1 changed files with 9 additions and 8 deletions

View File

@ -37,11 +37,12 @@ patterns.
.. function:: fnmatch(filename, pattern) .. function:: fnmatch(filename, pattern)
Test whether the *filename* string matches the *pattern* string, returning true Test whether the *filename* string matches the *pattern* string, returning
or false. If the operating system is case-insensitive, then both parameters :const:`True` or :const:`False`. If the operating system is case-insensitive,
will be normalized to all lower- or upper-case before the comparison is then both parameters will be normalized to all lower- or upper-case before
performed. If you require a case-sensitive comparison regardless of whether the comparison is performed. :func:`fnmatchcase` can be used to perform a
that's standard for your operating system, use :func:`fnmatchcase` instead. case-sensitive comparison, regardless of whether that's standard for the
operating system.
This example will print all file names in the current directory with the This example will print all file names in the current directory with the
extension ``.txt``:: extension ``.txt``::
@ -56,8 +57,8 @@ patterns.
.. function:: fnmatchcase(filename, pattern) .. function:: fnmatchcase(filename, pattern)
Test whether *filename* matches *pattern*, returning true or false; the Test whether *filename* matches *pattern*, returning :const:`True` or
comparison is case-sensitive. :const:`False`; the comparison is case-sensitive.
.. function:: filter(names, pattern) .. function:: filter(names, pattern)
@ -80,7 +81,7 @@ patterns.
>>> regex >>> regex
'.*\\.txt$' '.*\\.txt$'
>>> reobj = re.compile(regex) >>> reobj = re.compile(regex)
>>> print reobj.match('foobar.txt') >>> reobj.match('foobar.txt')
<_sre.SRE_Match object at 0x...> <_sre.SRE_Match object at 0x...>