Answers for "store name of all file in folder in to txt files python"

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 "store name of all file in folder in to txt files python"

Python Answers by Framework

Browse Popular Code Answers by Language