Convert Dictionary to String, vice versa?

Byron DesertLinux at netscape.net
Wed Sep 15 22:10:42 CEST 2004


Hi Peter,

Thank you for the information!  This will come in quite handy...

Byron
---

Peter Hansen wrote:
> In this particular case, this works:
> 
>  >>> d = eval(strNames)
>  >>> d
> {'Popcorn': 4.9500000000000002, 'Candy': 2.9500000000000002}
> 
> But be cautious using "exec" and "eval()", as they are
> potential security risks -- primarily when passing them data
> that comes from a user or has been made accessible to a user,
> such as by persisting it.  I suspect the answer to "how?"
> is in the FAQ.  If not, it's definitely in the list archives.
> 
> -Peter




More information about the Python-list mailing list