Python Learning note Three--use of dictionaries

Source: Internet
Author: User

One. Basic use:

1. Assignment: {Key:value}

1.1 In the same place as the list: changes in the value associated with the index (key) are changed

1.2 Different from the list: regardless of the length of the value, and the list is ordered to consider the end of the offset, more than the end of the offset will be an error.

2. Len (dictionary): Returns the number of keys

Two. Method of the Dictionary:

1. Take out all values in the dictionary: Values ()

2. Remove all keys in the dictionary and their corresponding values: Iterm ()

3. Determine if a key exists in the dictionary: Get ()

4. Two dictionary merges: update ()

5. Delete a key in the dictionary and return the value corresponding to this key: Pop ()

Python Learning note Three--use of dictionaries

Related Article

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.