Python: dictionary, pythondictionary

Source: Internet
Author: User

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)

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.