I use configparser and Python 3.3 to create a script that makes some small changes to the configuration files. These configuration files often contain comment lines, for example:
[Section]
Value1=Foo
Value2=Bar
It is understood that Python deletes them when it writes a new version of the configuration file, but something like a problem. Is there a way to copy comments into a new configuration file? (Unfortunately, order is also important. Thanks to OrderedDict, the order of configuration settings is maintained properly, but the order of comments should also be supported, which I hope will not be a problem.)
Thanks!
source
share