Python ascii() Function

❮ Built-in Functions


Example

Escape non-ascii characters:

x = ascii("My name is Ståle")
Run example »

Definition and Usage

The ascii() function returns a readable version of any object (Strings, Tuples, Lists, etc).

The ascii() function will replace any non-ascii characters with escape characters:

å will be replaced with \xe5.


Syntax

ascii(object)

Parameter Values

Parameter Description
object An object, like String, List, Tuple, Dictionary etc.

❮ Built-in Functions

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.