Python ascii() Function

Returns a readable version of an object by replacing non-ASCII characters with an escape character.

Syntax

Python
ascii(object)

Parameters

ParameterDescription
object Required. Any object that can be implicitely converted to a string, such as a string itself, number, Set, Dictionary etc

Example

Python
# Marc is Japanese:
marc = 'マーク'
readable = ascii(marc)
print('Marc in Japanese: ' + marc)
print('Marc in readable ASCII: ' + readable)

Output

Marc in Japanese: マーク
Marc in readable ASCII: '\u30de\u30fc\u30af'