Why do i get a 'PosixPath' object has no attribute 'walk'
exception?
from pathlib import Path
p = Path()
for dirpath, dirnames, filenames in p.walk():
print(dirpath, dirnames, filenames)
Path.walk
was added in Python 3.12, so you propably using an older version.
Instead, use os.walk
or Path.glob()
(or update your Python)
You can check the version in python with:
import sys
print(sys.version)