Answers for "show all files in folder python3"

7

list files in directory python

import os
print(os.listdir('/path/to/folder/to/list'))
Posted by: Guest on April-22-2020
1

store all files name in a folder python

import os
#this command will store all .txt files in same directories
ALL_FILES_IN_DIR = [ELEM for ELEM in os.listdir() if "txt" in ELEM]

#ALL DIRETORIES 
ALL_DIR = [ELEM for ELEM in os.listdir() if "." not in ELEM]
Posted by: Guest on December-25-2020

Code answers related to "show all files in folder python3"

Python Answers by Framework

Browse Popular Code Answers by Language