Use CSVs

A CSV is a comma-separated-value file. These are often used to represent a table of data with named columns and rows of records. For example:

language,author,website
Python,Guido,http://www.python.org/
Perl,Larry,http://www.perl.org/
Java,James,http://java.sun.com/

I use these in my sites to store configuration information. This could be:

You might also obtain csv's by saving a spreadsheet as that format, dumping SQL data, downloading information from a web site, or exporting data from some other program.

CSVs are easy to work with because they are text, can easily be read by your programs and can be edited with nice GUI programs.

GUIs

Do not torture yourself by editing csv's with a text editor except for the occasional tweak or search-and-replace. Instead use a spreadsheet which gives better presentation and navigation of the cells of data:

language

author

website

Python

Guido

http://www.python.org/

Perl

Larry

http://www.perl.org/

Java

James

http://java.sun.com/

On Linux, I have the best luck with gnumeric (even though I am typically a KDE fan, which provides KSpread). On Windows, I use Excel.

Python

Webware provides MiscUtils.DataTable which has excellent doc strings and is very easy to use. In addition to fully supporting the typical csv format (regarding embedded commas, quotes and newlines) (after Webware 0.6.1), it will also strip whitespace around fields and support simple one line #comments which are quite useful in "config" csv files.

If you want something lower level than DataTable, see MiscUtils.CSVParser which is the parsing guts for DataTable and can be used separately.

-- ChuckEsterbrook - 31 Dec 2001