470,849 Members | 1,259 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

How to create a dictionary from a string?

Is there a simple way to build a dictionary from a string without using
eval()?
s = '{"a":1}'
d = eval(s)
d

{'a': 1}

Regards, Clodoaldo Pinto

Apr 22 '06 #1
1 1259
Clodoaldo Pinto wrote:
Is there a simple way to build a dictionary from a string without using
eval()?
s = '{"a":1}'
d = eval(s)
d

{'a': 1}

Regards, Clodoaldo Pinto


Here is a discussion about one way to do it:
http://tinyurl.com/o8mmm

HTH
Michael

Apr 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Thomas Philips | last post: by
1 post views Thread by john wright | last post: by
4 posts views Thread by NullQwerty | last post: by
8 posts views Thread by shapper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.