tablib icon indicating copy to clipboard operation
tablib copied to clipboard

Plain text / Terminal formatter

Open davidfischer opened this issue 8 years ago • 2 comments

I thought I would open an issue to gauge interest in a terminal / plain text formatter. This possible formatter would print or read data from space padded plain text.

import tablib

data = tablib.Dataset()
data.headers = ('first_name', 'last_name')
data.append(('John', 'Adams'))
data.append(('George', 'Washington'))
print data.export('txt')
# first_name           last_name
# John                 Adams
# George               Washington

If you think this is useful and fits with the philosophy of the project, I could put together a PR.

There are definitely some differences between this and some of the other formatters including:

  • how wide should it print by default?
  • if the data is wider than the width, there will be data truncation
  • this can't really losslessly handle (outputting and then reading a dataset will result in differences) data with spaces at the beginning or end

davidfischer avatar Nov 30 '17 05:11 davidfischer

Yeah,I think it's interesting and useful

zobnec avatar Dec 07 '17 06:12 zobnec

bencede

Sahnesiguzel33 avatar Aug 05 '23 21:08 Sahnesiguzel33