0

how to print formatted unicode

i want to print unicode of given number i can format it to 4 digits i can print unicode of 4 digits by hardcoding But cant do it with getting a number i code: i=1 print('%04d'%(i))#output 0001 print('\u0001')#working print('\u%04d'%(i))#not working

30th Sep 2021, 2:13 AM
5152Vignesh .A
5152Vignesh .A - avatar
1 Answer
+ 1
The Unicode literal \uxxxxxx is not meant for specifying output length nor formatting the output. The `xxxxxx` characters following the backslash `\` symbol represents the value to be printed in hexadecimal format.
30th Sep 2021, 2:33 AM
Ipang