On Fri, 18 Jul 2008 10:04:29 -0400, Russell Blau wrote: > values = {} > for expression in line.split(" "): > if "=" in expression: > name, val = expression.split("=") > values[name] = val > […] > > And when you get to be a really hard-core Pythonista, you could write > the whole routine above in one line, but this seems clearer. ;-)
I know it's a matter of taste but I think the one liner is still clear (enough):: values = dict(s.split('=') for s in line.split() if '=' in s) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list