Simplest config file parser in the world!
Simplest config file parser in the world!
Nothing then split/strip/filter "combinators":
cfg = ''' a = aa aaa = aaaa b = bbb c=cccccccccc ''' split_pair = lambda s: s.split('=', 1) strip_pair = lambda p: map(str.strip, p) parse_rc = lambda s: map(strip_pair, map(split_pair, filter(None, s.splitlines()))) print dict(parse_rc(cfg))