Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How do I iterate over a subfolder in Python

import os

def list_files(dir):
    r = []
    for root, dirs, files in os.walk(dir):
        for name in files:
            r.append(os.path.join(root, name))
    return r
 
PREVIOUS NEXT
Tagged: #How #I #iterate #subfolder #Python
ADD COMMENT
Topic
Name
4+1 =