Python utf-8, howto align printout
- by Fredrik
Hi,
I have a array containing japanese caracters as well as "normal".
How do I align the printout of these?
#!/usr/bin/python
# coding=utf-8
a1=['??', '???', 'trazan', '??', '????']
a2=['dipsy', 'laa-laa', 'banarne', 'po', 'tinky winky']
for i,j in zip(a1,a2):
print i.ljust(12),':',j
print '-'*8
for i,j in zip(a1,a2):
print i,len(i)
print j,len(j)
Output:
?? : dipsy
??? : laa-laa
trazan : banarne
?? : po
???? : tinky winky
--------
?? 6
dipsy 5
??? 9
laa-laa 7
trazan 6
banarne 7
?? 6
po 2
???? 12
tinky winky 11
thanks,
//Fredrik