Python Glob.glob:- Need Help with reading Subdirectories contents | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python Glob.glob:- Need Help with reading Subdirectories contents

I am trying to compress image within my folder, containing more sub folders. I know how to compress image. just need help with reading subdirectories and it's contain. Output folder will contain same hierarchy of folders as target folder. Thanks in advance.

9th Dec 2020, 2:57 PM
Prit
Prit - avatar
1 Answer
+ 6
Prit , have you done an attempt by yourself so far? If not, please do so. Then you should post your try here, so that we can help you. As a hint for you: - use module os and os.walk - you need a nested for loop - the outer loop is using os.walk to get all information about paths and files and print the path - the inner loop prints the related files to a given path. Happy coding!
9th Dec 2020, 3:40 PM
Lothar
Lothar - avatar