(Jul-15-2021, 06:35 AM)korenron Wrote: what do I need to change \ do ?Not all system take pathlib object,then need to convert to normal string(str object).
Use
fspath
for this as is made just for this task.from pathlib import Path from os import fspath dest = r'G:\div_code\all_files' for path in Path(dest).rglob('*'): if path.is_file(): print(fspath(path))Use
type()
if you unsure what object
used.from pathlib import Path from os import fspath dest = r'G:\div_code\all_files' for path in Path(dest).rglob('*'): if path.is_file(): print(type(fspath(path)))
Output:<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>