I have noticed that str.format does not seem to do what is documented with Chinese characters.
Consider:
# -*- coding: utf-8 -*-
from __future__ import print_function
tests={'German': [u'Straße',u'auslösen',u'zerstören'],
'French': [u'français',u'américaine',u'épais'],
'Chinese': [u'中國的',u'英語',u'美國人']}
for k in tests.keys():
print(k)
for v in tests[k]:
print(u'"{:^15}"'.format(v))
My understanding, the "{:^15}"
format string should be fixed width. However, note the output:
Chinese
" 中國的 "
" 英語 "
" 美國人 "
French
" français "
" américaine "
" épais "
German
" Straße "
" auslösen "
" zerstören "
The field width for the Chinese characters are clearly changing. Nor are the Chinese strings being centered in the 15 character field.
Any idea why this is happening? I have tried both under Py 2.7 and Py 3.3