It is possible to access the comment, but keep in mind that there is
no supported API for it, and what I suggest below can stop working at
any time when internal details of iniparse change.
Take a look at the LineContainer class. INIConfig._data is a line
container, containing line containers:
>>> import iniparse
>>> inifile = """
... [section1]
... #comment 1
... option1 = value1
... #comment 2
... option2 = value2
... """
>>> from StringIO import StringIO
>>> i=iniparse.INIConfig(StringIO(inifile))
>>> i._data.find('section1')
<iniparse.ini.LineContainer object at 0x80de0ac>
>>> for x in i._data.find('section1').contents:
... print type(x), x
...
<class 'iniparse.ini.SectionLine'> [section1]
<class 'iniparse.ini.CommentLine'> #comment 1
<class 'iniparse.ini.LineContainer'> option1 = value1
<class 'iniparse.ini.CommentLine'> #comment 2
<class 'iniparse.ini.LineContainer'> option2 = value2
HTH,
-param