I want to print some unicode characters but u'\u1000'
up to u'\u1099'
. This doesn't work:
for i in range(1000,1100):
s=unicode('u'+str(i))
print i,s
Use the "\u" escape sequence to print Unicode characters In a string, place "\u" before four hexadecimal digits that represent a Unicode code point.
Inserting Unicode characters To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X. For more Unicode character codes, see Unicode character code charts by script.
The following example uses the UNICODE and NCHAR functions to print the UNICODE value of the first character of the string Åkergatan 24 , and to print the actual first character, Å . DECLARE @nstring NCHAR(12); SET @nstring = N'Åkergatan 24'; SELECT UNICODE(@nstring), NCHAR(UNICODE(@nstring));
To include Unicode characters in your Python source code, you can use Unicode escape characters in the form \u0123 in your string. In Python 2. x, you also need to prefix the string literal with 'u'.
You'll want to use the unichr() builtin function:
for i in range(1000,1100):
print i, unichr(i)
Note that in Python 3, just chr() will suffice.
Use unichr:
s = unichr(i)
From the documentation:
unichr(i)
Return the Unicode string of one character whose Unicode code is the integer i. For example, unichr(97) returns the string u'a'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With