conver string to dictionary
Michael Bentley
rmcore at gmail.com
Sun Feb 18 05:56:53 EST 2007
On Feb 18, 2007, at 12:44 AM, mahdieh saeed wrote:
> 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]}
# you're the one building the string?
a = eval('{"SalutationID":["primarykey",8388607,0,None],"CompanyID":
[0,8388607,0,"index"],
"SalutationName":["",255,0,None],"isDefault":["tinyint",1,1,None]}')
---
A clever person solves a problem.
A wise person avoids it.
-Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070218/861f25f4/attachment.html>
More information about the Python-list
mailing list