PyDocs

Nav

File and Directory Access

Path.write_bytes

pathlib

method of Path · Added in 3.5 (source)
  • Path.write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
1 Example
>>> p = Path('my_binary_file')
>>> p.write_bytes(b'Binary file contents')
20
>>> p.read_bytes()
b'Binary file contents'
from the Python docs
See Also
No see-alsos for pathlib/Path.write_bytes
0 Notes
No notes for Path.write_bytes