How to write bytes to file?

If you want to write bytes then you should open the file in binary mode.

f = open('/tmp/output', 'wb')

Leave a Comment