Created
June 8, 2011 19:24
-
-
Save elee/1015155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import fnmatch | |
import re | |
coredir = '/etc/sv/core' | |
# with fnmatch | |
cores = [file for file in os.listdir(coredir) if fnmatch.fnmatch(file, 'core.*')] | |
# with re.compile | |
pattern = re.compile(r'core.[0-9]+') | |
cores2 = [file for file in os.listdir(coredir) if pattern.match(file)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment