Path.write_bytes(data)
Open the file pointed to in bytes mode, write data to it, and close the file:
>>> p = Path('my_binary_file')
>>> p.write_bytes(b'Binary file contents')
20
>>> p.read_bytes()
b'Binary file contents'
An existing file of the same name is overwritten.
New in version 3.5.
Please login to continue.