How to concatenate and output unicode text variables in Python -


my title terms might not correct , may reason why can't find simple thing websites.

i have list of string variables. how concatenate them , output real unicode sentence in python?

base = ['280', '281', '282', '283'] end = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'] unicodes = [u''.join(['\u', j, i]) j in base in end]  u in unicodes:     print u 

i strings '\u280f' not real character. if do:

print u'\u280f' 

correct symbols shows up, is: ⠏

and i'm sure there more elegant way range of symbols u2800 u283f...

conver strings integers (using int base 16), use unichr (chr if you're using python 3.x) convert number unicode object.

>>> int('280' + 'f', 16)  # => 0x280f, 16: hexadecimal 10255 >>> unichr(int('280' + 'f', 16))  # unicode object u'\u280f' >>> print unichr(int('280' + 'f', 16)) ⠏ 

base = ['280', '281', '282', '283'] end = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'] unicodes = [unichr(int(j + i, 16)) j in base in end]  u in unicodes:     print u 

Comments

Popular posts from this blog

c# - Where does the .ToList() go in LINQ query result -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -