I was using pathlib module, for directory browsing. Here is the snippet i was trying.
import sys,os
from pathlib import Path
root = "C:\"
for path, subdirs, files in os.walk(root):
for name in files:
print(pathlib.PurePath(path, name))
I get the following exception: "NameError: name 'pathlib' is not defined"
You used from .. import ...
statement instead of import ..
.
Replacing following line:
from pathlib import Path
with:
import pathlib
will solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With