ASCII is abbreviated from of American Standard Code for Information Interchange. It is a character encoding standard. For example the ASCII value of English alphabet A is 65. Python provides this function to get the printable representation of an object. It takes one parameter which is an object that can be a list, strings, tuple etc. The output of the function is the hex representation. The non-ascii characters can be escaped using \x, \u or \U escapes.
The syntax is −
Printing strings with individual characters and multiple characters.
# Individual Characters print(ascii("Ω")) print(ascii("θ")) # A string int multiple characters print(ascii("TΨtΦrial"))
Running the above code gives us the following result −
'\u03a9' '\u03b8' 'T\u03a8t\u03a6rial'