Answers for "how to make python shows all files in directory"

8

python list all files in directory

from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
Posted by: Guest on April-04-2020
0

Get all file in folder Python

path = "C:code"

import glob

txtfiles = []
for file in glob.glob(path + "\*.m4a"):
    txtfiles.append(file)

for item in txtfiles:
    print(item)
Posted by: Guest on November-12-2021

Code answers related to "how to make python shows all files in directory"

Python Answers by Framework

Browse Popular Code Answers by Language