Skip to content Skip to sidebar Skip to footer

Alignment Of Wide East Asian Characters With Format Function

I am using python format method to align East Asian Wide (EAW) characters in my terminal display. The following python3 code illustrates my problem. ZH_STRING1 = '東京大学' ZH_

Solution 1:

In fact, I found a solution while writing this question. ^^

It is quite simple: Use the Unicode Ideographic Space (U+3000) in the python format function, which takes to normal spaces on the terminal output:

ZH_STRING1 = "東京大学"
ZH_STRING2 = "麻将"print(">" + "01234567" + "<")
print(">" + format(ZH_STRING1, " >4") + "<")
print(">" + format(ZH_STRING2, " >4") + "<")

Then:

enter image description here

Post a Comment for "Alignment Of Wide East Asian Characters With Format Function"