Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # encoding: utf-8
- #
- # Copyright (c) 2008 Doug Hellmann All rights reserved.
- #
- """Filter a list of filenames against a pattern.
- """
- __version__ = "$Id$"
- #end_pymotw_header
- import fnmatch
- import os
- import pprint
- pattern = 'fnmatch_*.py'
- print 'Pattern :', pattern
- files = os.listdir('.')
- print
- print 'Files :'
- pprint.pprint(files)
- print
- print 'Matches :'
- pprint.pprint(fnmatch.filter(files, pattern))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement