Answers for "access in directories using os python"

15

which folder python os

import os
cwd = os.getcwd()
Posted by: Guest on March-09-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 "access in directories using os python"

Python Answers by Framework

Browse Popular Code Answers by Language