What is binascii.b2a_uu in Python?

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.

Syntax

binascii.b2a_uu(data, *, backtick=False)

Parameters

  1. data: The data that needs to be converted. The length of returned line should be 45 at most.

  2. backtick: This is used if a user wishes to replace the zeros with a ā€˜`’.

import binascii
text = "HeLLo WorLd"
text = bytes(text , 'utf-8')
data = binascii.b2a_uu(text)
text = binascii.a2b_uu(data)
print(str(text), "<=>", str(data))
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
šŸ† Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved