I'm tring to get a beautiful list of my song info. "beautiful" means song names should occupy fixed width, like this:
songname1 singer1
songname2_xx singer2
this code works for chars whose width is one character width
file.write(u'{:<30}'.format(title).encode('utf-8'))
file.write(artist.encode('utf-8') + '\n')
But there are non-ascii chars that are wider:
Cycle 阿保剛
渐渐被你吸引 FIELD OF VIEW
what should I do to format strings like that?
Maybe iterating over all chars in a string and count the number of Chinese/Japanese characters. But I don't know exactly how to do this, and apparently it's error-prone.
Thank you!