Python .b2a_uu()

Anonymous contributor's avatar
Anonymous contributor
Published May 21, 2024
Contribute to Docs

The .b2a_uu() function converts binary data into a bytes object containing a string of ASCII characters in UUEncoded format.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Syntax

binascii.b2a_uu(data, *, backtick=false)
  • data: A bytes object containing the binary data to be encoded.
  • *: This indicates that any arguments following it must be passed using keyword syntax.
  • backtick: When set to True, it replaces zero bytes in the UUEncoded data with a backtick character (`).

Example

import binascii
# Create binary data to encode
binaryData = b"some text"
# Encode the binary data to UUEncoded ASCII format
encodedData = binascii.b2a_uu(binaryData)
print(encodedData)

This produces the following output:

b')<V]M92!T97AT\n'

Note: To learn how to convert back to binary format, visit .a2b_uu().

Codebyte Example

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours