Message118568
| Author |
nestor |
| Recipients |
aronacher, benjamin.peterson, georg.brandl, gpolo, mark.dickinson, nestor, rhettinger, terry.reedy |
| Date |
2010年10月13日.19:36:40 |
| SpamBayes Score |
9.738157e-06 |
| Marked as misclassified |
No |
| Message-id |
<1286998602.58.0.486068120725.issue10091@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
>>> import ast
>>> eval('{1:11,2:22}')
{1: 11, 2: 22}
>>> ast.literal_eval('{1:11,2:22}')
{1: 11, 2: 22}
>>> eval('{1,2}')
{1, 2}
>>> ast.literal_eval('{1,2}')
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
ast.literal_eval('{1,2}')
File "C:\Python31\lib\ast.py", line 80, in literal_eval
return _convert(node_or_string)
File "C:\Python31\lib\ast.py", line 79, in _convert
raise ValueError('malformed string')
ValueError: malformed string
>>>
I haven't tested for 2.7 or 3.2 but this bug probably applies also there. |
|