English documents:
-
CHR
(
i
- Return The string representing a character whose Unicode code point is the integer
i . For example,
CHR ($)
returns the string
' a ' , while CHR (8364)
returns the string ' € ' . This is the inverse of ord ()
.
-
The valid range for the argument are from 0 through 1,114,111 (0x10ffff in base 16).
valueerror
'll be raised if
I was outside that range
-
-
Description:
-
1. function returns the string representation of the Unicode character corresponding to the value of the Shaping parameter
-
>>> chr (97)#parameter type is an integer'a'>>> Chr (' the')#argument passed in string times wrongTraceback (most recent): File"<pyshell#6>", Line 1,inch<module>Chr (' the') Typeerror:an integer isrequired (got type str)>>> Type (CHR (97))#The return type is a string<class 'Str'>
2. Its function is exactly the opposite of the Ord function.
>>> chr'a'>>> ord ('a') 97
3. The range of parameter values passed in must be between 0-1114111 (16 binary 0x10ffff), otherwiseValueError错误
>>> chr (-1)#less than 0 errorTraceback (most recent): File"<pyshell#10>", Line 1,inch<module>Chr (-1) VALUEERROR:CHR () Arg not inchRange (0x110000)>>> Chr (1114111)'\u0010ffff'>>> chr (1114112)#over 1114111 errorsTraceback (most recent): File"<pyshell#13>", Line 1,inch<module>Chr (1114112) VALUEERROR:CHR () Arg not inchRange (0x110000)
Python built-in functions (Ten)--CHR