Test whether FILENAME matches PATTERN. Patterns are Unix shell style: * matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any char not in seq An initial period in FILENAME is not special. Both FILENAME an
(name, pat)
| 24 | |
| 25 | |
| 26 | def fnmatch(name, pat): |
| 27 | """Test whether FILENAME matches PATTERN. |
| 28 | |
| 29 | Patterns are Unix shell style: |
| 30 | |
| 31 | * matches everything |
| 32 | ? matches any single character |
| 33 | [seq] matches any character in seq |
| 34 | [!seq] matches any char not in seq |
| 35 | |
| 36 | An initial period in FILENAME is not special. |
| 37 | Both FILENAME and PATTERN are first case-normalized |
| 38 | if the operating system requires it. |
| 39 | If you don't want this, use fnmatchcase(FILENAME, PATTERN). |
| 40 | """ |
| 41 | |
| 42 | name = name.lower() |
| 43 | pat = pat.lower() |
| 44 | return fnmatchcase(name, pat) |
| 45 | |
| 46 | |
| 47 | def fnmatchcase(name, pat): |