On this page
  1. ascii
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

ascii

Prev: any | Up: __builtins__ | Next: bin
Rel: bin, chr, format, hex, oct
Ref: docs.python.org — ascii
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import ascii

Overview & Signature

ascii(obj, /)

Return an ASCII-only representation of an object.

Usage

assert ascii("café 🐍") == "'caf\\xe9 \\U0001f40d'"

Gotchas

REPL Inspect

help(ascii)

Linked from

Related notes