How-to articles, tricks, and solutions about BINARY

Python int to binary string?

You can use the built-in bin() function to convert an integer to a binary string in Python.

Reading binary file and looping over each byte

Here is an example code snippet that demonstrates how to read a binary file and loop over each byte in Python:

What does the 'b' character do in front of a string literal?

The 'b' character in front of a string literal indicates that the string is a bytes literal.