Gopal wrote: >Thanks for the reference. However, I'm not understanding how to use it. >Could you please provide with an example? Like I open the file, read >line and give it to parser? > >Please help me. > > > I had thought of recommending what Peter Hansen recommended - just importing the text you have as a Python module. I don't know why I recommended ConfigParser over that option. However, if you don't like what Peter said and would still like to look at ConfigParser, here is a very simple example. Here is the config file I created from your email:
[EMAIL PROTECTED] 8:36AM configparser % cat foo.txt [main] PROJECT_ID = "E4208506" SW_VERSION = "18d" HW_VERSION = "2" Here is me running ConfigParser from a Python shell: In [1]: import ConfigParser In [2]: p = ConfigParser.ConfigParser() In [3]: p.read("foo.txt") Out[3]: ['foo.txt'] In [4]: p.get("main", "PROJECT_ID") Out[4]: '"E4208506"' Note that the value of ("main", "PROJECT_ID") is a string which contains double quotes in it. If you take Peter's advice, you won't have that problem; the config file will preserve your types for you. HTH, - JMJ -- http://mail.python.org/mailman/listinfo/python-list