Path.write_text(data, encoding=None, errors=None)
Open the file pointed to in text mode, write data to it, and close the file:
1 2 3 4 5 | >>> p = Path( 'my_text_file' ) >>> p.write_text( 'Text file contents' ) 18 >>> p.read_text() 'Text file contents' |
New in version 3.5.
Please login to continue.