Package: txtable
txtable - Plain text tables for Python 3Pretty-print tabular data as plain text. Supports Markdown and reStructuredText tables too.Sample outputsDefault formatterDate        Mobile Operating System  Percent of Usage
==========  =======================  ================
2008-12-01                  Android                 0
2008-12-01                      iOS             32.56
2008-12-01                SymbianOS             42.02
2008-12-01                Series 40                 0
2008-12-01            BlackBerry OS                 0
2008-12-01                  Samsung                 0
2008-12-01                  Unknown                16
2008-12-01            Windows Phone                 0Headless formatterDate        Mobile Operating System  Percent of Usage
2008-12-01                  Android                 0
2008-12-01                      iOS             32.56
2008-12-01                SymbianOS             42.02
2008-12-01                Series 40                 0
2008-12-01            BlackBerry OS                 0MD formatterDate       | Mobile Operating System | Percent of Usage
---------- | ----------------------- | ----------------
2008-12-01 |                 Android |                0
2008-12-01 |                     iOS |            32.56
2008-12-01 |               SymbianOS |            42.02
2008-12-01 |               Series 40 |                0
2008-12-01 |           BlackBerry OS |                0RST formatter+------------+-------------------------+------------------+
| Date       | Mobile Operating System | Percent of Usage |
+============+=========================+==================+
| 2008-12-01 |                 Android |                0 |
+------------+-------------------------+------------------+
| 2008-12-01 |                     iOS |            32.56 |
+------------+-------------------------+------------------+
| 2008-12-01 |               SymbianOS |            42.02 |
+------------+-------------------------+------------------+
| 2008-12-01 |               Series 40 |                0 |
+------------+-------------------------+------------------+
| 2008-12-01 |           BlackBerry OS |                0 |
+------------+-------------------------+------------------+InstallationIt’s the usual process as with any other Python package:python3setup.pyinstallOr install with pip:pip3installtxtableUsage as a moduleDefault usage:# let's pretty-print a CSV fileimportcsvfromtxtableimportTextTablewithopen("cities.csv")asf:data=list(csv.reader(f))# the TextTable constructor takes a sequence type as the first argumentprint(TextTable(data))Use a formatter (available formatters are DefaultFormatter, HeadlessFormatter, MdFormatter, RstFormatter):print(TextTable(data,formatter=MdFormatter()))Command-line usageThe command-line interface supports formatting input data in JSON and CSV format. Input can be a list of files or stdin.catcities.csv|python3-mtxtable-tcsv-fmdcurlhttp://ponydealer.com/api/available.json|python3-mtxtable-tjsonCommand-line helpusage:txtable[-h][-fFORMATTER][-tTYPE][files[files...]]positionalarguments:filesPathtoinputfiles(json/csv)orreadfromstdinwhenempty(default:[])optionalarguments:-h,--helpshowthishelpmessageandexit-fFORMATTER,--formatterFORMATTERTableformat:default,headless,md(Markdown)orrst(ReStructuredText)(default:default)-tTYPE,--typeTYPEInputdatatypetoreadfromstdin:json/csv(default:json)