Hi,
I'm trying to read subdirectories only (with the path) but the code I found also prints the top dir+path that is "C:\\01'
I probably could write the output to a file and then would remove the first line from it but it is kind of unnecessary work.
Thank you in advance.
Here is the code:
I'm trying to read subdirectories only (with the path) but the code I found also prints the top dir+path that is "C:\\01'
I probably could write the output to a file and then would remove the first line from it but it is kind of unnecessary work.
Thank you in advance.
Here is the code:
Python:
import os
given_path = 'C:\\01'
for path, dirs, files in os.walk(given_path):
print ("This is path to: " + path)
for f in files:
print ("These are files:" +f)
for d in dirs:
print("These are Directories:" + d)