News for hackers. Stuff that matters.
Re:Pylsy: Python library to represent tabular data in ASCII ... by bru on Monday August 31, 2015 @05:06AM (#10146034)
Isn't that exactly what tabulate has been doing very well for a while? https://pypi.python.org/pypi/tabulate

Note the variety of formats: 'ascii', but also html, latex & co.

Re:Pylsy: Python library to represent tabular data in ASCII ... by IanCal on Monday August 31, 2015 @06:11AM (#10146134)
Tabulate is also excellent for the command line tool it provides, I use it to convert csv output into tables for GH comments all the time.
Re:Pylsy: Python library to represent tabular data in ASCII ... by viraptor on Monday August 31, 2015 @05:07AM (#10146035)
PrettyTable is an established library which does the same: https://code.google.com/p/prettytable/
Re:Pylsy: Python library to represent tabular data in ASCII ... by roddux on Monday August 31, 2015 @05:55AM (#10146108)
The introduction is almost identical: '[Pylsy/PrettyTable] is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables'
Re:Pylsy: Python library to represent tabular data in ASCII ... by cryon on Monday August 31, 2015 @11:42AM (#10147312)
I noticed that too. The copy paste is strong in this one.
Re:Pylsy: Python library to represent tabular data in ASCII ... by YesThatTom2 on Monday August 31, 2015 @06:43AM (#10146204)
I've used PrettyTable for years. I don't see how this improves upon it
Re:Pylsy: Python library to represent tabular data in ASCII ... by joepvd on Monday August 31, 2015 @05:14AM (#10146049)
Cool!

Sorry for the plug, but this gawk program does something similar:

https://github.com/joepvd/table

Field splitting can be defined with all of (g)awks possibilities. Features different styles, among which unicode table borders.

Re:Pylsy: Python library to represent tabular data in ASCII ... by networked on Monday August 31, 2015 @10:05AM (#10146829)
Nice utility! I've written a quick clone of it in Tcl for use on systems without GNU Awk: http://wiki.tcl.tk/41682.
Re:Pylsy: Python library to represent tabular data in ASCII ... by joepvd on Monday August 31, 2015 @10:55AM (#10147068)
Aha! That must have been the first time I have tried to read Tcl for more than a minute :) Looks like one can prototype fast in this language. Thanks for writing / posting!
Re:Pylsy: Python library to represent tabular data in ASCII ... by kbd on Monday August 31, 2015 @08:12AM (#10146433)
Judging by this thread there are a surprising number of tools dedicated to this. Typically when I need tabular output I stick the data into a Pandas dataframe and its output format is usually good enough.
Re:Pylsy: Python library to represent tabular data in ASCII ... by mih on Monday August 31, 2015 @06:57AM (#10146232)
This is my choice for tables on Python - https://github.com/Robpol86/terminaltables. The appearance of tables is adequately configurable. The project is also actively maintained unlike some of the others.
Re:Pylsy: Python library to represent tabular data in ASCII ... by ORioN63 on Monday August 31, 2015 @07:59AM (#10146397)
Incredible how everyone in this thread has a different opinion on what is the best python library that works with table.
Re:Pylsy: Python library to represent tabular data in ASCII ... by jiri on Monday August 31, 2015 @08:32AM (#10146506)
Yeah. Probably, the reason is that you can code it easily in few hundred lines and it looks decent and cool.
Re:Pylsy: Python library to represent tabular data in ASCII ... by LesZedCB on Monday August 31, 2015 @08:02AM (#10146408)
It's basically this in real time! https://xkcd.com/927/
Re:Pylsy: Python library to represent tabular data in ASCII ... by wizzardy on Monday August 31, 2015 @09:57AM (#10146801)
If anyone interested in similar library in C language, take a look at my simple libTprint library: https://github.com/wizzard/libtprint Hope it helps!
Re:Pylsy: Python library to represent tabular data in ASCII ... by theophrastus on Monday August 31, 2015 @10:54AM (#10147063)
This recalls some of the table formatting and exporting magic one can easily achieve with emacs org-mode. http://orgmode.org/guide/Tables.html And there, if you like, you can include a full set of spreadsheet operations.
Re:Pylsy: Python library to represent tabular data in ASCII ... by calpaterson on Monday August 31, 2015 @07:24AM (#10146303)
Cool project. You might be able to use Hypothesis (https://hypothesis.readthedocs.org/en/master/) for testing this to make sure you catch all of the little edge cases.
Re:Pylsy: Python library to represent tabular data in ASCII ... by skept on Monday August 31, 2015 @10:36AM (#10146972)
csvlook [0] is another great tool that does this for any CSV file. It's part of the very useful csvkit[1] suite of command line utilities for working with CSV files.

[0] http://csvkit.readthedocs.org/en/latest/scripts/csvlook.html

[1] http://csvkit.readthedocs.org/en/latest/index.html

Re:Pylsy: Python library to represent tabular data in ASCII ... by nahiluhmot on Monday August 31, 2015 @10:14AM (#10146867)
Re:Pylsy: Python library to represent tabular data in ASCII ... by smellf on Monday August 31, 2015 @02:33PM (#10148283)
To do this, I would just tab-delimit stdout and pipe through `column -t`. Though I can see how a dedicated lib would be better for some use cases.
Re:Pylsy: Python library to represent tabular data in ASCII ... by BetaCygni on Monday August 31, 2015 @04:32AM (#10145964)
Takes up too much (vertical) space.
Re:Pylsy: Python library to represent tabular data in ASCII ... by asgard1024 on Monday August 31, 2015 @04:55AM (#10146017)
I agree - perhaps there should be an option to control where and if you want to have the vertical and horizontal lines?
Re:Pylsy: Python library to represent tabular data in ASCII ... by ipozgaj on Monday August 31, 2015 @10:42AM (#10146996)
I've tried several of similar libraries, and still find `tabulate` the best.
Re:Pylsy: Python library to represent tabular data in ASCII ... by mpdehaan2 on Monday August 31, 2015 @08:19AM (#10146470)
Suggest a move to "Show HN"