lmaurits / prettytable

Automatically exported from code.google.com/p/prettytable
Other
22 stars 6 forks source link

constructor formatting is overridden by get_string() #70

Open mzagrabe opened 6 years ago

mzagrabe commented 6 years ago

I create a PrettyTable as such:

!/usr/bin/python3

from prettytable import PrettyTable

t = PrettyTable( header = False, border = False, padding_width = 0, )

t.add_row(['a', 'b', 'c', 'd',])

print(t) print(t.get_string(padding_width = 0))

and run it:

$ python3 prettytest a b c d abcd

I would expect the stringify of the table, "print(t)", would use the formatting option of "padding_width=0" to print it, but it is clear that the get_string() doesn't use the constructor's formatting options.

a b c d

If you manually set the padding_width for the get_string call, then the desired results is achieved:

abcd

The two print calls in the above example should yield the same results.

Thanks!