I used PrettyTable
module in the Python 3.6,but the output table is not aligned (like the red rectangle in the picture).I have searched this issue on the internet,but no good answer.
Is it because there're some Chinese language in the table?
All the data of the rows are from a list which contains lots of dictionaries. The code is as follows:
def prettyPrint(self,trains):
pt = PrettyTable()
pt.title = 'Results for Query Tickets'
pt.field_names = ["车次", "出发站","到达站", "出发时间","到达时间", "历时", "商务座特等座","一等座", "二等座", "软卧", "动卧", "硬卧", "硬座", "无座"]
pt.align["车次"] = "l"
for train in trains:
pt.add_row(train.values())
print(pt)
How to make it? Thanks.