I need to write some comment in a configuration file generated at runtime via ConfigParser
library in Python.
I want to write a full descriptive comment like:
########################
# FOOBAR section
# do something
########################
[foobar]
bar = 1
foo = hallo
The code should look like:
Where I insert comment and configurations options in the same moment.
import ConfigParser
config = ConfigParser.ConfigParser()
config.insert_comment("##########################") # This function is purely hypothetical
config.insert_comment("# FOOBAR section ")
....
config.add_section('foobar')
config.set('foobar', 'bar', '1')
config.set('foobar', 'foo', 'hallo')