The binascii is a widely used Python library for ASCII-encoded binary representations. It contains several methods to convert to binary from ASCII or hex, and vice versa. Most methods are not used directly, but wrapper modules such as uu, base64, or binhex are commonly used.
binascii.b2a_uu is one of the many wrapper modules in the binascii library. It is used to convert data (in binary) to a line of ASCII characters. This means the ASCII characters are returned as a single line with a ā\nā character at the end to indicate to new line character.
binascii.b2a_uu(data, *, backtick=False)
data: The data that needs to be converted. The length of returned line should be 45 at most.
backtick: This is used if a user wishes to replace the zeros with a ā`ā.
import binasciitext = "HeLLo WorLd"text = bytes(text , 'utf-8')data = binascii.b2a_uu(text)text = binascii.a2b_uu(data)print(str(text), "<=>", str(data))
Free Resources