Skip to content

uu Module

The uu module provides uuencoding/uudecoding for transmitting binary data over text channels (legacy, rarely used).

Complexity Reference

Operation Time Space Notes
encode() O(n) O(n) n = input bytes; deprecated, use base64
decode() O(n) O(n) n = encoded bytes; deprecated, use base64

Encoding and Decoding

Uuencoding Files

import uu
import io

# Encode - O(n)
with open('binary.dat', 'rb') as f:
    with open('binary.uu', 'w') as out:
        uu.encode(f, out)

# Decode - O(n)
with open('binary.uu', 'r') as f:
    with open('binary.dat', 'wb') as out:
        uu.decode(f, out)