[Numpy-discussion] Reading automatically all the parameters from a file

Robert Kern robert.kern@gmail....
Wed Nov 30 05:21:14 CST 2011


On Wed, Nov 30, 2011 at 11:09, Giovanni Plantageneto
<g.plantageneto@gmail.com> wrote:
> Dear all,
> I have a simple question. I would like to have all the parameters of a
> model written in a configuration file (text), and I would like to have
> all the parameters in the file automatically defined inside a program.
> I find ConfigParser a bit low level, is there any function that
> automatically reads everything from a file?

You may want to give something like configobj a try.

  http://pypi.python.org/pypi/configobj

It builds on ConfigParser to read all of the parameters in and creates
a hierarchical object will all of the parameters as attributes.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list