Convert a text file content to a dictionary...

Skip Montanaro skip at pobox.com
Mon Feb 3 18:28:03 EST 2003


    Francois> I want to read a simple text file that has 2 columns (tab
    Francois> delimited), and put that content in a dictionary. What is the
    Francois> best way to achieve this???

Get Object Craft's csv module (speedy, written in C) or Cliff Wells' DSV
module (slower, but pure python) or if you like to live on the bleeding
edge, you can check out the up-and-coming standard csv module (based on
Object Craft's module).  It's only available via CVS.  You can browse and
download at

    http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/nondist/sandbox/csv/

Skip





More information about the Python-list mailing list