Python chr() Function is used to convert an integer to its Unicode character. This function returns a string from a Unicode code integer.
number: An integer representing a valid Unicode code point
ValueError – for an out-of-range integer number
TypeError – for a non-integer argument
Simple example code.
print(97, chr(97)) print(65, chr(65)) print(1200, chr(1200))
Printing characters for each Unicode integer in the numbers list.
numbers = [101, 111, 110] for number in numbers: letter = chr(number) print("ASCII value", number, "is ", letter)
ASCII value 101 is e
ASCII value 111 is o
ASCII value 110 is n
Do comment if you have any doubts or suggestions on this Python function topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.