#!/usr/bin/python def foo(): print 'hello world' # python calls these dictionaries. # associative arrays # An array indexed by an int, a string , or other types # key:data # make an empty map x = {} print x x = {'a':4, 'b':7,'hello':27} print x print x['a'] x['test'] = "this is a new value" print x x['foo'] = foo print x for key in x.keys(): print "\t", key, "\t\t", x[key] print for key in sorted(x.keys()): print "\t", key, "\t\t", x[key] print 'a' in x print 'c' in x for item in x.items(): print "\t",item print "\t\t", item[0],"\t", item[1] print del x['foo'] print x print x.clear() print x print