Ads by ProfitSence
Close

Python chr()

Last Updated on Wednesday 5th Oct 2022

python chr

python chr function

chr python - function returns the character that represents the specified unicode.

The syntax of chr() is

			
					chr(num)

			
	

chr() python

Syntax

			
					chr(number)

			
	

python chr()

  • chr() method takes a single parameter, an integer number.
  • The valid range of the integer is from 0 through 1,114,111.

chr function python

Parameter Values

  • number - An integer representing a valid Unicode code point
			
					print(chr(69))
print(chr(44))
print(chr(90))
print(chr(65))
print(chr(97))

			
	
			
					E
,
Z
A
a

			
	

If the integer passed to chr() is out of the range , ValueError will be raised.

			
					print(chr(-1))

# ValueError: chr() arg not in range(0x110000)

			
	

When you run the program, ValueError is raised , because the argument passed to chr() method is out of the range.

Reference