“Listen Sie Bilder im Verzeichnis Python auf” Code-Antworten

Python Holen Sie sich alle Bilder im Verzeichnis

import glob

for filename in glob.iglob(root_dir + '**/*.jpg', recursive=True):
    # Do something
CBT fan club

Listen Sie Bilder im Verzeichnis Python auf

import os

# specify the img directory path
path = "path/to/img/folder/"

# list files in img directory
files = os.listdir(path)

for file in files:
    # make sure file is an image
    if file.endswith(('.jpg', '.png', 'jpeg')):
        img_path = path + file

        # load file as image...
Ugly Unicorn

Ähnliche Antworten wie “Listen Sie Bilder im Verzeichnis Python auf”

Fragen ähnlich wie “Listen Sie Bilder im Verzeichnis Python auf”

Weitere verwandte Antworten zu “Listen Sie Bilder im Verzeichnis Python auf” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen