Skip to content

Line breaks are stripped when maxcolwidths argument is used #367

@DrewDevereux

Description

@DrewDevereux

When the maxcolwidths argument is used, explicit line breaks are stripped out and replaced with spaces:

>>> table = [("a\na", 1), ("b", 2)]
>>> print(tabulate(table, tablefmt="grid"))
+---+---+
| a | 1 |
| a |   |
+---+---+
| b | 2 |
+---+---+
>>> print(tabulate(table, tablefmt="grid", maxcolwidths=10))
+-----+---+
| a a | 1 |
+-----+---+
| b   | 2 |
+-----+---+
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions