question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

My code is like this:

from tabulate import tabulate


res = [{'object': '1986', 'relation': '出生日期', 'subject': '爱德华·尼科·埃尔南迪斯'}, {'object': '哥伦比亚', 'relation': '国籍', 'subject': '爱德华·尼科·埃尔南迪斯'}, {'object': '70公分', 'relation': '身高', 'subject': '爱德华·尼科·埃尔南迪斯'}]

title = ['subject', 'relation', 'object']
tbl = [title] + [[el['subject'], el['relation'], el['object']] for el in res]
tbl = tabulate(tbl, headers='firstrow', tablefmt='orgtbl', colalign=('right',))

print(tbl)

And the result is:

|      subject | relation   | object   |
|--------------+------------+----------|
| 爱德华·尼科·埃尔南迪斯 | 出生日期       | 1986     |
| 爱德华·尼科·埃尔南迪斯 | 国籍         | 哥伦比亚     |
| 爱德华·尼科·埃尔南迪斯 | 身高         | 70公分     |

How could I make the column aligns well ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
astanincommented, Feb 20, 2021

This problem is fixed in 0.8.8.

1reaction
Kyle-sncommented, Sep 24, 2020

I just installed wcwidth but it has not fixed this issue for me. I thought that maybe I am just misunderstanding something so apologies if this is unrelated to tabulate/wcwidth.

cat-ing the file via cli returns: image

Pasting the value in this comment returns the same issue it returns when the table is emailed to myself. ±----------------±-----------+ | Date | 2020-09-16 | | Closing value | 3385.49 | | Notional change | -15.71 | | Percent change | -0.46 | ±----------------±-----------+

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alignment error counter increments due to a misconfiguration ...
Alignment errors are the count of the number of frames received that do not end with an even number of octets and have...
Read more >
How to find an alignment error in a passage given in websites
No. Justified alignment means that the text is word spaced to be flush to the margins on both the left and the right....
Read more >
Alignment Errors & Misalignments - Matterport Help Center
An alignment error is when the Matterport Capture app cannot align the current scan to your previous scans. In this case, Matterport Capture ......
Read more >
HP inkjet printers - Alignment errors | HP® Customer Support
1. Load plain white paper in the input tray. 2. Adjust the paper width guides until they rest against the edges of the...
Read more >
Effects of Alignment Error and Alignment Filtering on the ...
Two different types of alignment error might cause a false negative at a positively selected site: either misalignment of one or more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found