I have been writing a quick Python tutorial for nearly two years, and it has finally taken shape. This series of articles includes Python basics, standard library, and Django framework. The successive articles contain the most important components of Python. The scope of this content far exceeds my expectations and exceeds any Python related book I have read. The reason why I started writing this book in the first place was not only to summarize it, but also to be dissatisfied with many Python books and tutorials. I thought they were too obscure and not comprehensive enough. Now, I am relatively sure that by referring to my summary on Linux, network, and algorithms, readers can learn Python in depth in a short time without any basic background.
This article is also the end. Prepare to stop updating the Python quick tutorial for a long time and focus on other aspects. After all, if you do something for a long time, you will lack self-breakthrough. Programming is a very innovative job that requires self-breakthrough. If you stay in one area for too long, you will feel bad. In the unknown computer field, there are still many interesting technologies worthy of more in-depth study. On the other hand, Python is so comfortable to use that when I think of problems, I basically think of them in Python. In this way, Python has become my comfort zone. I'm too lazy to think about how Java will solve it, how Scala will solve it, and how C will solve it. The space for growth is very small. In order to move forward, you must break out of this comfort zone.
Thank you for reading these Python articles. Your support is my biggest motivation to get to this point. I hope these technical articles can embellish your leisure time. It would be great if I could get some more concrete help.
The following is a post I answered on Zhihu "How did you learn Python by yourself", slightly modified as a summary:
I am self-taught Python. From knowing nothing about Python to writing a series of Python-related articles on the blog, there were many hurdles, but it was also full of fun. Fun is the greatest motivation for self-study. Python is an easy-to-write and powerful dynamic language. Using Python, you can achieve quite powerful functionality in just a few lines. By writing some small programs yourself, you can quickly see the effects and find problems. This is the most convenient place to learn Python. In "Hackers and Painters", Paul also said that dynamic languages can give Hackers more pleasure in painting. This is very close to my heart.
Before learning Python, you can learn about the characteristics and design concepts of Python (a brief history of Python). From the beginning of its design, Python tried to find a balance between the complexity and power of C and the convenience and limited functionality of bash. Python's syntax is relatively simple and easy to use, so some people use it as a scripting language. But Python is much more powerful than ordinary scripting languages. Through good scalability, Python has quite comprehensive functions and a wide range of applications: web server, web crawler, scientific computing, machine learning, game development... Of course, there is no free lunch in the world, and there is no perfect language. Python is for To achieve the above two points, the running speed of Python is intentionally sacrificed. If you are writing programs with high business volume and calculation volume, Python may not be the best choice.
-----
The main content of Python can be roughly divided into the following parts:
Process-oriented. Including basic expressions, if statements, loops, functions, etc. If you have the foundation of any language, especially the foundation of C language, this part is about understanding the provisions of Python in minutes. If you have no language foundation, it is recommended to use Python Programming as a reference book. This book is an introductory computer textbook and does not require programming knowledge.
Object-oriented, including basic object-oriented concepts, classes, methods, properties, inheritance, etc. Python is an object-oriented language, "everything is an object". Object orientation is hard to avoid. Python's object-oriented mechanism is relatively loose and not as strict as Java and C++. The advantage is that it is easy to learn and maintain, but the disadvantage is that it is easy to make mistakes.
Application functions, including IO, data containers such as tables and dictionaries, built-in functions, modules, formatted strings, etc. These often appear in other languages and have strong practicality.
Advanced syntax, context managers, list comprehensions, functional programming, decorators, special methods, etc. These syntaxes are not required, you can use the more basic syntaxes above. The main reason to learn these advanced syntaxes is that they are so convenient. For example, what can be done in one line using list derivation, would take several lines using a loop structure.
The best reference book for learning Python is Learning Python. It is very comprehensive and full of useful information. Although it is thick, it is not difficult to read. The other is to refer to the tutorial on the official website Python.org
Python is known as "Battery Included", which means that all functions are already included in the language. This confidence mainly comes from Python's comprehensive standard library. The standard library provides many functional modules, each module is an interface for a certain aspect of functionality, such as file management, operating system interaction, character processing, network interface, encoding and encryption, etc.
In The Python Standard Library, you can see the list of standard library modules. This is also the best learning material for the standard library. If you are looking for books, I have only seen two books about the standard library:
Python Essential Reference
The Python Standard Library by Example
To be honest, these two standard library textbooks are not very good, and the standard library reference book is indeed difficult to write. Because the standard library is just an interface for calling functions, what is ultimately achieved is the interaction between Python and the system. This requires strong system knowledge, such as file system knowledge, process management, http principles, socket programming, database principles... If these knowledge are fully prepared, then the standard library will not be difficult to learn at all. However, the learning curve for this background knowledge is much steeper than that of Python itself.
The same is true for more in-depth Python learning, which requires a lot of background knowledge, not just Python itself. If you are interested in the scalability of Python, you can try more hybrid programming. If you are interested in the compilation and running mechanism of Python, you can dig deeper into the bottom layer of Python and see how the compiler does it. If you are interested in applications, you can learn a few more third-party packages that you can use yourself. When you learn this, what you are fighting for is realm, and there is no fixed method. A vast space left to be explored.
Basically, after learning the main content, Python still needs to be practiced by doing projects. There are a lot of small exercise-type materials, such as the Python Cookbook. But a better way is to think of some application scenarios yourself and use Python to solve them. For example:
Build a website
Make a web crawler
System Management
Python has comprehensive functions, so don’t worry that Python can’t solve the problem you want to solve (basically, problems that Python can’t solve cannot be solved by other languages). For example, my motivation to learn multi-threading is because I need to download a large number of files in parallel. Basically, after a project, several pieces of Python will be used, and the knowledge will be particularly consolidated.
Finally, like any other knowledge learning, taking notes and summarizing are important. When reading reference books and web pages, you can take some notes. After you have studied for a period of time, you can organize your notes into more organized reference cards or write a blog.

Calculating the total number of elements in a PHP multidimensional array can be done using recursive or iterative methods. 1. The recursive method counts by traversing the array and recursively processing nested arrays. 2. The iterative method uses the stack to simulate recursion to avoid depth problems. 3. The array_walk_recursive function can also be implemented, but it requires manual counting.

In PHP, the characteristic of a do-while loop is to ensure that the loop body is executed at least once, and then decide whether to continue the loop based on the conditions. 1) It executes the loop body before conditional checking, suitable for scenarios where operations need to be performed at least once, such as user input verification and menu systems. 2) However, the syntax of the do-while loop can cause confusion among newbies and may add unnecessary performance overhead.

Efficient hashing strings in PHP can use the following methods: 1. Use the md5 function for fast hashing, but is not suitable for password storage. 2. Use the sha256 function to improve security. 3. Use the password_hash function to process passwords to provide the highest security and convenience.

Implementing an array sliding window in PHP can be done by functions slideWindow and slideWindowAverage. 1. Use the slideWindow function to split an array into a fixed-size subarray. 2. Use the slideWindowAverage function to calculate the average value in each window. 3. For real-time data streams, asynchronous processing and outlier detection can be used using ReactPHP.

The __clone method in PHP is used to perform custom operations when object cloning. When cloning an object using the clone keyword, if the object has a __clone method, the method will be automatically called, allowing customized processing during the cloning process, such as resetting the reference type attribute to ensure the independence of the cloned object.

In PHP, goto statements are used to unconditionally jump to specific tags in the program. 1) It can simplify the processing of complex nested loops or conditional statements, but 2) Using goto may make the code difficult to understand and maintain, and 3) It is recommended to give priority to the use of structured control statements. Overall, goto should be used with caution and best practices are followed to ensure the readability and maintainability of the code.

In PHP, data statistics can be achieved by using built-in functions, custom functions, and third-party libraries. 1) Use built-in functions such as array_sum() and count() to perform basic statistics. 2) Write custom functions to calculate complex statistics such as medians. 3) Use the PHP-ML library to perform advanced statistical analysis. Through these methods, data statistics can be performed efficiently.

Yes, anonymous functions in PHP refer to functions without names. They can be passed as parameters to other functions and as return values of functions, making the code more flexible and efficient. When using anonymous functions, you need to pay attention to scope and performance issues.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
