I wanted to generate URLs for all files in a folder hierarchy
for path, folder, files in os.walk("C:/Users/guptamols/Course/tutorials"):
for names in files:
print(os.path.join(path,names))
Result:
C:/Users/guptamols/Course/tutorials\ch1\Ass1.txt
C:/Users/guptamols/Course/tutorials\ch1\Ass2.txt
I found that these issues can be resolved using the Pathlib module, So i tried:
from pathlib import Path
for path, folder, files in os.walk("C:/Users/guptamols/Course/tutorials"):
for name in files:
Path.joinpath(path,names)
It gives this error
AttributeError: 'str' object has no attribute '_make_child'
Where am i going wrong?