I have a following type of INI file
[section1][subsection1]
port=989
[section1][subsection2]
somethign=somethign
I am using ConfigParser of Python to parse the INI file but I am not able to figure it out on how to get the data from the above kinda INI file.
the below code is for getting the value when INI file is like
[section1]
port=908
[section2]
ss=ss
config = ConfigParser.RawConfigParser()
config.read(INI_File)
mIp = config.get('section1','port')
Please don't suggest me to change the INI file format :)
thank you
It appears that ConfigParser ignores subsections. If you absolutely need subsections, you may want to try alternative parsers such as ConfigObj (PyPi, tutorial)
And here is an answer to an older question: https://stackoverflow.com/a/3008051/49412