Trying to understand a very simple class - from the book "dive into python"

Diez B. Roggisch deets at nospam.web.de
Wed May 20 18:18:05 CEST 2009


walterbyrd wrote:

> On May 20, 9:59 am, Marco Mariani <ma... at sferacarta.com> wrote:
> 
>> Do you know what a dictionary is?
> 
> Yes, but I thought  a dictionary used curly brackets. Is the object a
> dictionary?

foo = {"key" : "i'm the value of a dictionary"}
print foo["key"]

I suggest you read the tutorial:

http://docs.python.org/tutorial/datastructures.html#dictionaries

Diez



More information about the Python-list mailing list