Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

binascii
b2a_uu

What is binascii.b2a_uu in Python?

Sarvech Qadir

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))

RELATED TAGS

binascii
b2a_uu

CONTRIBUTOR

Sarvech Qadir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring