Answers for "get all directory from directory python"

1

how to get all folders on path in python

os.walk(directory)
[x[0] for x in os.walk(directory)]
Posted by: Guest on February-10-2020
0

scan all directories with python

import glob

# path to search single character filename
path = "sales/?.jpeg"
for file in glob.glob(path):
    print(file)

# path to search three-character filename
path = "sales/???.jpeg"
for file in glob.glob(path):
    print(file)

# search file that starts with word 'cha' followed by exact two-character
path = "sales/cha??.txt"
for file in glob.glob(path):
    print(file)
Posted by: Guest on August-08-2021

Code answers related to "get all directory from directory python"

Python Answers by Framework

Browse Popular Code Answers by Language