basic python list/dict/key question/issues..

Albert Hopkins marduk at letterboxes.org
Tue Jan 13 18:35:55 CET 2009


On Tue, 2009-01-13 at 08:59 -0800, bruce wrote:
> Hi..
> 
> quite new to python, and have a couple of basic question:
> 
> i have 
>  ("term":["1","2","3"])
> 
> as i understand it, this is a list, yes/no?
> 
No, that's invalid syntax:

        >>> ("term":["1","2","3"])
          File "<stdin>", line 1
            ("term":["1","2","3"])
                   ^
        SyntaxError: invalid syntax

> how can i represent this as a dict/list?

["this","is","a","list"]
{"this":1, "is":2, "a": 3, "dict": 3}
> 
> i've got a few of these that i'm trying to deal with..

If you are new to python you might to read up on a tutorial.

http://docs.python.org/tutorial/







More information about the Python-list mailing list