Python Learning notes (day2)

Source: Internet
Author: User

1. There is no concept of constants in Python, such as Pi. Typically, the variable name capitalization defaults to constant, but it can still be changed.

2. Python 3.x or later versions of. pyc files are moved to the __pycache__ folder. A program that is executed manually does not generate a. pyc file, which is generated only when it is called by another program.

3. python3.x above version does not have a long length integer type.

4. Python has a del global command that can delete variables, elements, lists, dictionaries, and so on.

5. python3.x above, the list's sort () method can no longer sort the values and strings together.

6. For a discussion of assignments, shades, and slices, see my blog post.

7. The method of numeric value, string, list, tuple, dictionary, please see one of my special blog post.

8. The dictionary's items () method requires a dictionary to be converted to a list, which is inefficient if the amount of data is larger.

Therefore, use the following loops as much as possible:

Adict = {...}

For key in Adict:

Print (Key,adict[key])

Instead of using:

For k,v in Adict.items ():

Print (K,V)

9. The update () method of the dictionary is to update the old dictionary with a new dictionary. If you have the same key in both, the value of the new dictionary overwrites the old dictionary (including the structure). If there is no key, it is added to the old dictionary.

Exit prompt, you can quit the program directly.

Python Learning notes (day2)

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.