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