Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import fnmatch
- import os, re
- pattern = fnmatch.translate("*.jpg")
- for file in os.listdir("samples"):
- if re.match(pattern, file):
- print file
- print "(pattern was %s)" % pattern
- ## sample.jpg
- ## (pattern was .*\.jpg$)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement