[Tutor] Reading information from a text file into a list of lists (WinXP/py2.6.2)

Kent Johnson kent37 at tds.net
Mon Oct 26 13:22:55 CET 2009

On Sun, Oct 25, 2009 at 6:53 PM, Katt <the_only_katala at verizon.net> wrote:
> Hello all,
> Currently I am working on a program that reads text from a text file.  I
> would like it to place the information int a list and inside the information
> would have sublists of information.
> The text file looks like this:
> "Old Test","2009_10_20"
> "Current Test","2009_10_25"
> "Future Test","2009_11_01"
> I am trying to get the list of lists to look like the following after the
> information is read from the text file:
> important_dates = [["Old Test","2009_10_20"],["Current
> Test",2009_10_25"],["Future Test","2009_11_01"]]

Take a look at the csv module in the standard lib. You can configure
it to use comma as the delimiter and it will handle the quotes for


More information about the Tutor mailing list