Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. import fnmatch
  2. import os, re
  3.  
  4. pattern = fnmatch.translate("*.jpg")
  5.  
  6. for file in os.listdir("samples"):
  7. if re.match(pattern, file):
  8. print file
  9.  
  10. print "(pattern was %s)" % pattern
  11.  
  12. ## sample.jpg
  13. ## (pattern was .*\.jpg$)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement