ConfigParser & converting strings to lists

Edward K. Ream edream at tds.net
Sun Jun 23 06:12:23 EDT 2002


To complete this topic, let me restate the problem and JohnJacob's
elegant solution.

Suppose files is a list of strings, and we have written a configuration
section like this:

  config = ConfigParser.ConfigParser()
  config.set("recent files", "recentFiles, files)

Then the elegant way of retrieving files _as a list_ is:

  files = eval(config.get("recent files", "recentFiles"))

Thanks to all who replied.

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edream at tds.net
Leo: Literate Editor with Outlines
Leo: http://personalpages.tds.net/~edream/front.html
--------------------------------------------------------------------



More information about the Python-list mailing list