Path.read_text(encoding=None, errors=None)
Return the decoded contents of the pointed-to file as a string:
1 2 3 4 5 | >>> p = Path( 'my_text_file' ) >>> p.write_text( 'Text file contents' ) 18 >>> p.read_text() 'Text file contents' |
The optional parameters have the same meaning as in open()
.
New in version 3.5.
Please login to continue.