Python: dictionary, pythondictionary
# Python3.4 Eclipse + PyDev open Eclipse, find the Help menu bar, and enter Install New Software.... # Click work with: click Add... next to the input box ..., Name can be whatever it is, I enter PyDev, Location is http://pydev.org/updates. Click OK. Import jsonimport osimport nltkimport collectionsimport heapqimport operatorimport itertoolssent = ["In", "the", "beginning", "God", "created"]; wo = nltk. bigrams (sent); for w in wo: print (w); # dictionary geovindu juwen prices = {"ACME": 45.23, "APPLE": 612.79, "IBM ": 205.55, "HP": 37.20, "FB": 10.67}; min_prices = min (zip (prices. values (), prices. keys (); max_prices = max (zip (prices. values (), prices. keys (); sort_prices = sorted (zip (prices. values (), prices. keys (); name_prices = min (prices, key = lambda k: prices [k]); max_pricesstr = max (zip (prices. values (), prices. keys (); print ("minimum value:" + name_prices); for mi in min_prices: print (mi) # print (min_prices); # print (max_prices ); # print (sort_prices); print ("sort:"); for mis in sort_prices: print (mis) print ("maximum stock:"); for mix in max_prices: print (mix) # dirA = {"geovindu": 32, "Ji juwen": 28, "Jiang Dong": 12, "40": 40, "english": 22} dirB = {"tu juwen": 28, "Jiangsu": 32, "Liu ruoying": 40, "Jiangdong": 12, "geovindu": 32, "english": 22} dirkey = dirA. keys () & dirB. keys (); dirvalues = dirA. items () & dirB. items (); print ("keys:") print (dirkey); print ("values:") print (dirvalues)