A difference between--pycharm and Python idle printing when keys are duplicated in a dictionary

Source: Internet
Author: User

The same key is not allowed to appear two times in Python. When created, if the same key is assigned a value of two times, the latter value is remembered, as in the following example:

 Dict1 = { " name   ": "  runoob  , "  age   ": 7, "  name   ": "   Young rookie   " }   Print  ( " dict1[' Name ']:   ", Dict1["  name  " Span style= "COLOR: #800000" > "]) 

If it is pycharm (Community edition v3.4.4), then Pycharm will have a hint: Dictionary contains duplicate keys ' Name ' more ...

Actually no print:

If Python comes with idle, the last value of the same key will be printed

A difference between--pycharm and Python idle printing when keys are duplicated in a dictionary

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.