Title: maxcolwidths isn't properly respected: extra whitespace is added · Issue #354 · astanin/python-tabulate · GitHub
Open Graph Title: maxcolwidths isn't properly respected: extra whitespace is added · Issue #354 · astanin/python-tabulate
X Title: maxcolwidths isn't properly respected: extra whitespace is added · Issue #354 · astanin/python-tabulate
Description: Testcase: from tabulate import tabulate headers = ['Header#1', 'Header#2', 'Header#3'] data = [] data.append(['Alpha beta gama zeta omega', 'The weather was exceptionally good that day again', 'The files were concatenated and archived fo...
Open Graph Description: Testcase: from tabulate import tabulate headers = ['Header#1', 'Header#2', 'Header#3'] data = [] data.append(['Alpha beta gama zeta omega', 'The weather was exceptionally good that day again', 'The...
X Description: Testcase: from tabulate import tabulate headers = ['Header#1', 'Header#2', 'Header#3'] data = [] data.append(['Alpha beta gama zeta omega', 'The weather was exce...
Opengraph URL: https://github.com/astanin/python-tabulate/issues/354
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"maxcolwidths isn't properly respected: extra whitespace is added","articleBody":"Testcase:\r\n```\r\nfrom tabulate import tabulate\r\n\r\nheaders = ['Header#1', 'Header#2', 'Header#3']\r\ndata = []\r\ndata.append(['Alpha beta gama zeta omega', 'The weather was exceptionally good that day again', 'The files were concatenated and archived for posterity.'])\r\ndata.append(['Delta omega beta alpha nu and the rest', 'The weather was exceptionally good that day', 'They decided to engage in many businesses and all of them were successful.'])\r\n\r\nprint(tabulate(\r\n data,\r\n headers=headers,\r\n tablefmt='fancy_grid',\r\n maxcolwidths=[None, None, 8]))\r\n```\r\n\r\nThe output:\r\n```\r\n╒════════════════════════════════════════╤═══════════════════════════════════════════════════╤════════════╕\r\n│ Header#1 │ Header#2 │ Header#3 │\r\n╞════════════════════════════════════════╪═══════════════════════════════════════════════════╪════════════╡\r\n│ Alpha beta gama zeta omega │ The weather was exceptionally good that day again │ The │\r\n│ │ │ files │\r\n│ │ │ were con │\r\n│ │ │ catenate │\r\n│ │ │ d and │\r\n│ │ │ archived │\r\n│ │ │ for post │\r\n│ │ │ erity. │\r\n├────────────────────────────────────────┼───────────────────────────────────────────────────┼────────────┤\r\n│ Delta omega beta alpha nu and the rest │ The weather was exceptionally good that day │ They │\r\n│ │ │ decided │\r\n│ │ │ to │\r\n│ │ │ engage │\r\n│ │ │ in many │\r\n│ │ │ business │\r\n│ │ │ es and │\r\n│ │ │ all of │\r\n│ │ │ them │\r\n│ │ │ were suc │\r\n│ │ │ cessful. │\r\n╘════════════════════════════════════════╧═══════════════════════════════════════════════════╧════════════╛\r\n```\r\n\r\nThe last column in the output has 2 extra spaces.\r\nThe data was wrapped at the requested column width of 8, but then 2 extra spaces were added.\r\n\r\nThis is important because maxcolwidths can be (and is in my case) calculated based on the actual terminal width, and adding extra space makes the table to overflow the terminal.\r\n\r\n\r\nVersion: 0.9.0\r\nPython 3.11 (3.9 works the same way)\r\n","author":{"url":"https://github.com/yurivict","@type":"Person","name":"yurivict"},"datePublished":"2024-11-14T20:28:00Z","url":"https://github.com/astanin/python-tabulate/issues/354"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:49e4a80a-0a73-3918-449a-444970fa7851 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B35C:DAB93:19E4F:223AF:6AFF495B |
| html-safe-nonce | b1b74bc8ffba38fe92cf4f10c1908e42d53fa8ddeded95cc0c6c65d33e78fa6e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzVDOkRBQjkzOjE5RTRGOjIyM0FGOjZBRkY0OTVCIiwidmlzaXRvcl9pZCI6IjQyNzM4MjY2NTcwMTUzODQ0MTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8f60aa5125aaef91226ff1d0398385a256ec962ac4de13786e7b6bef0b79aa6a |
| hovercard-subject-tag | issue:2659963125 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/astanin/python-tabulate/354/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a0cb5db984d6cff4807cb7bb12b23410ec7f0a8112dd702174b7aa0134ab1863/astanin/python-tabulate/issues/354 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a0cb5db984d6cff4807cb7bb12b23410ec7f0a8112dd702174b7aa0134ab1863/astanin/python-tabulate/issues/354 |
| og:image:alt | Testcase: from tabulate import tabulate headers = ['Header#1', 'Header#2', 'Header#3'] data = [] data.append(['Alpha beta gama zeta omega', 'The weather was exceptionally good that day again', 'The... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yurivict |
| hostname | github.com |
| expected-hostname | github.com |
| None | f8b2d3504728b977eef904ac11b7ccf890d15b9fcf803becc3cdc7bf46af99bd |
| turbo-cache-control | no-preview |
| go-import | github.com/astanin/python-tabulate git https://github.com/astanin/python-tabulate.git |
| octolytics-dimension-user_id | 71802 |
| octolytics-dimension-user_login | astanin |
| octolytics-dimension-repository_id | 205875548 |
| octolytics-dimension-repository_nwo | astanin/python-tabulate |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 205875548 |
| octolytics-dimension-repository_network_root_nwo | astanin/python-tabulate |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d90de1784c9f993ceba8e551e35cc316865b9d79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width