kragniz / kragniz/prettytable

how to display "ambiguous" width in chinese character?

Open
#51 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
from prettytable import PrettyTable
header="乘客姓名,性别,出生日期".split(",")

x = PrettyTable(header)
x.align["乘客姓名"]="l"
table='''HuangTianhui,男,1948/05/28
姜翠云,女,1952/03/27
李红晶,女,1994/12/09
LuiChing,女,1969/08/02
宋飞飞,男,1982/03/01
唐旭东,男,1983/08/03
YangJiabao,女,1988/08/25
买买提江·阿布拉,男,1979/07/10
安文兰,女,1949/10/20
胡偲婠(婴儿),女,2011/02/25
(有待确定姓名),男,1985/07/20
'''
data=[row for row in table.split("\n") if row]
for row in data:
x.add_row(row.strip().split(","))

print(x)

```

Original issue reported on code.google.com by `elearn2...@gmail.com` on 28 Apr 2014 at 11:10

Attachments:
- [display.JPG](https://storage.googleapis.com/google-code-attachments/prettytable/issue-51/comment-0/display.JPG)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied Python example and observing how PrettyTable sizes columns containing Chinese characters. Trace the table-width calculation from PrettyTable's rendering entry point; done means the displayed columns align correctly for the provided mixed Chinese and Latin data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.