Posted on September 12, 2020
Contents
The pathlib module handles file paths with support for different operating systems.
The example below uses pathlib to read text from a file.
import pathlib
text = pathlib.Path('myfile.txt').read_text()
print(text)
Gavin Wiggins © 2020