0001 #!/usr/bin/env python 0002 # -*- coding: gbk -*- 0003 # 0004 # Example of Python dictionary (hashtable) 0005 # 0006 beauty = dict({ # declare and initialize a dictionary object 0007 "":"ʩ", 0008 "":"Ѿ", 0009 "":"", 0010 "߻":"" 0011 }) 0012 print u'\n'.join(u' * ( %s : %s )' % (alias.decode('gbk').strip(), name.decode('gbk').strip()) for (alias, name) in beauty.items()) 0013 0014 beauty[""] = "ԲԲ" 0015 print u'\n'.join(u' | ( %s : %s )' % (alias.decode('gbk').strip(), name.decode('gbk').strip()) for (alias, name) in beauty.items()) 0016 0017 for (alias, name) in beauty.items(): 0018 print " = (", alias, ":", name, ")" 0019 0020 for (alias, name) in sorted(beauty.items()): 0021 print " | (", alias, ":", name, ")" 0022 0023 for alias in sorted(beauty.keys(), reverse = True): 0024 print " - (", alias, ":", beauty[alias], ")"