Open the file in text mode, read it, and close the file.
>>> p = Path('my_text_file') >>> p.write_text('Text file contents') 18 >>> p.read_text() 'Text file contents'
pathlib/Path.read_text
Path.read_text