Skip to content

Instantly share code, notes, and snippets.

@travis23
Created January 11, 2019 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travis23/4f21e7528f6b707389b493812ba51edf to your computer and use it in GitHub Desktop.
Save travis23/4f21e7528f6b707389b493812ba51edf to your computer and use it in GitHub Desktop.
[files in directory] get a list of all the files in a directory #os #filename #python
# See
# https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment