17.7. Pathlib Content

  • Path.read_text() - Read the content of a file as text

  • Path.write_text(data) - Write text data to a file

  • Path.read_bytes() - Read the content of a file as bytes

  • Path.write_bytes(data) - Write bytes data to a file