+ 3

how i encode unicode chrs in python

so im making chr list gen,but its limited to 127 cuz idk how to encode unicode chrs https://code.sololearn.com/cY2cyRkUWVPe/?ref=app try to change range(0,127) to range(0,256) and it wont work

13th Jan 2019, 5:31 AM
prisma
prisma - avatar
2 Answers
+ 4
Add these lines at the beginning of your code: import unicodedata import sys, codecs sys.stdout = codecs.getwriter('utf_16')(sys.stdout.buffer, 'strict') Also, you don't need to increase i in your for loop. That's literally what for i in range is for. Neither strings nor chars have to be converted to strings in order to print them
13th Jan 2019, 6:26 AM
Anna
Anna - avatar