[Tutor] Printing concatenated unicode strings

Tim Golden mail at timgolden.me.uk
Mon Oct 20 16:43:47 CEST 2008


Siim Märtmaa wrote:
> i would like to do this
> 
>>>> print u'\u30fa'
>> 
> with a method like this
> 
> b = "30fa"
> uni = u'\u' + b + '\''
> 
> but it prints this
> 
> UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in
> position 0-1: end of string in escape sequence
> 
> so how to concatenate properly to print the character ヺ
> 
> I want to do this to print the characters in a loop so that b would change


>>> help (unichr)
Help on built-in function unichr in module __builtin__:

unichr(...)
    unichr(i) -> Unicode character

    Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.

>>>


TJG


More information about the Tutor mailing list