How to write binary data to stdout in python 3?

A better way:

import sys
sys.stdout.buffer.write(b"some binary data")

Leave a Comment