Kamilche wrote: > Hi everyone. I'm trying to convert a string that looks like this: > > gid = 'FPS', type = 'Label', pos = [0, 20], text = 'FPS', text2 = 'more > text without quotes', fmtline = "@VALUE @SIGNAL", signals = [('FPS', > None), ('FPS2', 'something')] > > to a dict that looks like this: > > {'signals': [('FPS', None), ('FPS2', 'something')], 'text': 'FPS', > 'pos': [0, 20], 'text2': 'more text without quotes', 'gid': 'FPS', > 'type': 'Label', 'fmtline': '@VALUE @SIGNAL'} > > I've got a home-rolled routine that was 'good enough', until I added > the list of tuples in there. Now it's failing. I have a hack to > 'special case' it, but you know that will come up to bite me in the > future. > > Does anyone have a thought on how I can turn what are basically > function keyword arguments in string form, to a dict, without using > exec or eval? > > --Kamilche >
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 HTH Michael -- http://mail.python.org/mailman/listinfo/python-list