bundlewrap/libs/ini.py
mwiegand e799cf8c6c wip
2021-06-30 02:51:23 +02:00

24 lines
466 B
Python

from configparser import ConfigParser
def parse(text):
config = ConfigParser()
config.read_string(text)
return {
section: dict(config.items(section))
for section in config.sections()
}
class Writable():
data = ''
def write(self, line):
self.data += line
def dumps(dict):
config = ConfigParser()
config.read_dict(dict)
writable = Writable()
config.write(writable)
return writable.data