En Sun, 18 Feb 2007 03:44:47 -0300, mahdieh saeed <[EMAIL PROTECTED]> escribió:
> Hi > I want to convert string to dictionary .what is the best solution for > this ? > for example string is like this: > > '{"SalutationID":["primarykey",8388607,0,None],"CompanyID":[0,8388607,0,"index"], > "SalutationName":["",255,0,None],"isDefault":["tinyint",1,1,None]}' > and I want to convert this string to this dictionary: > > {"SalutationID":["primarykey",8388607,0,None],"CompanyID":[0,8388607,0,"index"], > "SalutationName":["",255,0,None],"isDefault":["tinyint",1,1,None]} > please help me what is the best solution(faster solution) for this? The simplest way is to use eval(), but only do that if you can trust absolutely the source. To be safe, you can use this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list