On May 8, 2011 2:00pm, Dan Stromberg <[email protected]> wrote:

On Sun, May 8, 2011 at 8:20 AM, Greg Lindstrom [email protected]> wrote:

Is it possible to create a dictionary from a string value? Something along these lines (but that works):

>>> mystring = "{'name':'greg','hatsize':'7 5/8'}"
>>> mystring


"{'name':'greg','hatsize':'7 5/8'}"
>>> dict(mystring)
Traceback (most recent call last):
File "", line 1, in
ValueError: dictionary update sequence element #0 has length 1; 2 is required


Yes. It works like a champ. Thanks!
--greg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to