Answers for "find file without listing path python3"

6

python get all file names in a dir

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

python list all files of directory in given pattern

import glob
print(glob.glob("/home/adam/*.txt"))
// output ['/home/adam/file1.txt', '/home/adam/file2.txt', .... ]
Posted by: Guest on June-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language