Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- # quickly list files in a dir with specific filetype
- # without recursion into subdirs
- thepath = '/Your_Dir/' # some path
- filetype = '.py' # use this format .bla
- le=len(filetype)
- pdffiles = [i for i in os.listdir(thepath) if i[-le:] == filetype]
- for afile in pdffiles:
- print afile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement