import os files_and_dirs = [f for f in os.listdir('.')] files = [f for f in os.listdir('.') if os.path.isfile(f)]