Python ascii()

ASCII – American Standard Code for Information Interchange

The ascii() function returns a string containing a printable representation of an object and escapes the non-ASCII characters in the string using \x, \u or \U escapes.

Syntax

ascii(object)
object - String , List , tuple etc.

Ex.

list = ['P¥thon' , 'µ', ' CodË it']
print(ascii(list))

Output :

['P\xa5thon', '\xb5', ' Cod\xcb it']

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s