
Want to work with files and directories in Python?
pathlib gives a single interface for all file-related needs:
from pathlib import Path
p = Path('/etc/passwd')
with p.open() as infile:
for one_line in infile:
print(len(one_line), end=' ')
