A better way:
import sys
sys.stdout.buffer.write(b"some binary data")
More Related Contents:
- how to use a while loop in my python code
- python 3.2 if-else
- How to use string.replace() in python 3.x
- Behavior of exec function in Python 2 and Python 3
- How to set sys.stdout encoding in Python 3?
- Remove and Replace Printed items [duplicate]
- Why does on_message stop commands from working?
- jumping too fast?
- How to use a custom comparison function in Python 3?
- multiprocessing vs multithreading vs asyncio in Python 3
- filedialog, tkinter and opening files
- Why print in Python doesn’t pause when using sleep in a loop?
- How to use cmp() in Python 3?
- Make python3 as my default python on Mac
- Discord Bot can only see itself and no other users in guild
- __init__() missing 1 required positional argument
- How can I more easily suppress previous exceptions when I raise my own exception in response?
- How to move a sprite according to an angle in Pygame
- List comprehension returning values plus [None, None, None], why? [duplicate]
- “TypeError: a bytes-like object is required, not ‘str'” when handling file content in Python 3
- SyntaxError on “self.async” when running python kafka producer
- What SOAP libraries exist for Python 3.x? [closed]
- not all arguments converted during string formatting.. NO % variables
- json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 190) [duplicate]
- Same name for classmethod and instancemethod
- Why isn’t isnumeric working?
- How to calculate length of string in pixels for specific font and size?
- Why are str.count(”) and len(str) giving different outputs when used on an empty string?
- Convert binary string to bytearray in Python 3
- ‘is’ operator behaves unexpectedly with floats