Python ascii() FunctionLast Updated : 17 Mar 2025 The python 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. Python ascii() Function SyntaxLet us take an example to demonstrate the ascii() function in Python. Parametersobject: It takes an object like strings, list etc. ReturnIt returns a readable version of an object and replaces none-ascii characters with the escape character. Python ascii() Function ExampleHere, we are going to discuss different examples for Python ascii() Function works in Python. Output: 'Python is interesting' 'Pyth\xf6n is interesting' Pyth�n is interesting Explanation: In the above example, variables such as normalText, and otherText contain the string values, and returns ascii value of a particular variable. Next TopicPython Functions |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India