30 skills required to learn python and python30 skills

Source: Internet
Author: User
Tags unpack

30 skills required to learn python and python30 skills

 

Collect these useful shortcuts

1. Exchange two numbers in the same place

We create a new tuple on the right of the value assignment, and parse the unpack (unreferenced) tuples on the left to the variables <a> and <B>

When the value assignment is complete, the new tuples become unreferenced and marked useless. Finally, the variable exchange is completed.

2. chain-like comparison Operators

3. conditional assignment using ternary Operators

4. multiline string

5. Store list elements to new variables

6. Print the file path of the import module

7. The "_" operator in the interactive environment

8. Dictionary/set Derivation

9. debug the script

10. enable file sharing

If you have any questions during the learning process or want to obtain learning resources, join the learning exchange group.

626062078. Let's learn Python together!

11. Check the objects in Python

12. Simplify the if statement

13. Check the Python version at runtime

14. Combine multiple strings

15. Four string/list flip Methods

16. Playback Enumeration

17. Use enumeration in Python

18. Return multiple values from the method

19. Use the * operator (splat operator) To unpack function parameters.

20. use dictionaries to store selection operations

21. One line of code is used to calculate the factorial of any number.

22. Find the number that appears most frequently in the list.

23. Reset recursive restrictions

24. Check the memory usage of an object

Python 2.7 A 32-bit integer occupies 24 bytes

Python 3.5 uses 28 bytes. To determine memory usage, we can call the getsizeof method:

25. Use _ slots _ to reduce memory spending

26. Use lambda to simulate the Output Method

27. Build a dictionary from two Related Sequences

28. Search for multiple prefix and suffix strings in one line of code

29. Create a list without repeating

30. Implement a True switch-case statement in Python

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.