Multi-line text within a cell does not format well with _outline formatting
See original GitHub issueI am working on printing output that sometimes have multiline entries in a cell. I like the *_outline tblfmtโs and am wondering if the format can be adapted to fix formatting with multilines
tabulate version 0.9.0
Code
import tabulate as tb
from tabulate import tabulate
print(tb.__version__)
header = ['A', 'B', 'C', 'D']
row1 = [
'1', '2', '3', '4'
]
row2 = [
'5', '6', '7', '8\n88'
]
row3 = [
'9', '10', '11', '12'
]
table_body = []
table_body.append(row1)
table_body.append(row2)
table_body.append(row3)
print(tabulate(table_body, headers=header))
print(tabulate(table_body, headers=header, tablefmt='pretty'))
print(tabulate(table_body, headers=header, tablefmt='simple_outline'))
print(tabulate(table_body, headers=header, tablefmt='rounded_outline'))
Output:
0.9.0
A B C D
--- --- --- ---
1 2 3 4
5 6 7 8
88
9 10 11 12
+---+----+----+----+
| A | B | C | D |
+---+----+----+----+
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| | | | 88 |
| 9 | 10 | 11 | 12 |
+---+----+----+----+
โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโ
โ A โ B โ C โ D โ
โโโโโโโผโโโโโโผโโโโโโผโโโโโโโค
โ 1 โ 2 โ 3 โ 4 โ
โ 5 โ 6 โ 7 โ 8
88 โ
โ 9 โ 10 โ 11 โ 12 โ
โโโโโโโดโโโโโโดโโโโโโดโโโโโโโ
โญโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโฎ
โ A โ B โ C โ D โ
โโโโโโโผโโโโโโผโโโโโโผโโโโโโโค
โ 1 โ 2 โ 3 โ 4 โ
โ 5 โ 6 โ 7 โ 8
88 โ
โ 9 โ 10 โ 11 โ 12 โ
โฐโโโโโโดโโโโโโดโโโโโโดโโโโโโโฏ
Issue Analytics
- State:
- Created 10 months ago
- Comments:9
Top Results From Across the Web
Excel Tips 31 - Add Multiple Lines to Text within Cells - YouTube
This allows you to have paragraph style formatting for text within a cell whereby you can enter text on lines below other text...
Read more >How to Make Multiple Lines in Excel Cell - Excelchat - Got It AI
Formatting Cell as Wrap Text ยท Select the cells having long text ยท On the Home tab, in the Alignment group select the...
Read more >How to copy multi-line text from Excel without quotes?
(The blue outlines.) Paste Special Options. To get unformatted text in Word without the double quotes: Paste the text in formatted so it...
Read more >Excel format for number, text, scientific notation, accounting, etc.
The tutorial explains the basics of Excel format for number, text, currency, percentage, accounting number, scientific notation, and more.
Read more >How to put multiple lines into cells in Microsoft Excel
Just go to the Home tab and click on Wrap Text: Good news: You can apply this formatting to more than one cell...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The file you downloaded is the right one. Can you check the help of
tabulate
once youโve imported it?Just to be sure you imported from the right file.
OK, so that worked. This line from your output gave me the idea on how to do it.
>>> from MyPackages.tabulate import tabulate
Thank you, that PR does fix the issue.