String To Dict Problem
Clodoaldo Pinto
clodoaldo.pinto at gmail.com
Fri Apr 21 21:40:29 EDT 2006
Michael Spencer wrote:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469
Very nice work. It will be very useful. Thanks.
Only a small problem when I try to evaluate this:
safe_eval('True')
I get:
Traceback (most recent call last):
File "safe_eval.py", line 63, in ?
safe_eval('True')
File "safe_eval.py", line 59, in safe_eval
return walker.visit(ast)
File "safe_eval.py", line 19, in visit
return meth(node, **kw)
File "safe_eval.py", line 23, in default
return self.visit(child, **kw)
File "safe_eval.py", line 19, in visit
return meth(node, **kw)
File "safe_eval.py", line 47, in visitName
node.name, node)
__main__.Unsafe_Source_Error: Line 1. Strings must be quoted: True
This is just to let you know. I can live with that. I just replace True
for 1.
Regards, Clodoaldo Pinto
More information about the Python-list
mailing list