The syntax of
Return Value from ascii()
It returns a string containing a printable representation of an object.
ö is changed to
√ is changed to
The non-ASCII characters in the string are escaped using
Example 1: How ascii() method works?
normalText = 'Python is interesting' print(ascii(normalText)) otherText = 'Pythön is interesting' print(ascii(otherText)) print('Pyth\xf6n is interesting')
'Python is interesting' 'Pyth\xf6n is interesting' Pythön is interesting
randomList = ['Python', 'Pythön', 5] print(ascii(randomList))
['Python', 'Pyth\xf6n', 5]