Just an example of dictionary object in python.

PythonWin 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit
(Intel)] on win32.
Portions Copyright 1994-2004 Mark Hammond ([EMAIL PROTECTED]) -
see 'Help/About PythonWin' for further copyright information.
>>> d = {}
>>> d["key1"] = "value1"
>>> d["key2"] = "value2"
>>> d["key3"] = "value3"
>>> d["key3"] = "value3"
>>>
>>> for i, j in d.items():
...     print i, j
...
key3 value3
key2 value2
key1 value1
>>> if d.has_key("key1"):
...     print d["key1"]
... else:
...     print "no key"
...
value1
>>> if d.has_key("not in dict"):
...     print d["key1"]
... else:
...     print "no key"
... 
no key
>>> 

HTH

Sameer

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to