Home >Backend Development >PHP Tutorial >Python Quick Tutorial Ending_PHP Tutorial

Python Quick Tutorial Ending_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:35:47772browse

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/742265.htmlTechArticleThe Python quick tutorial I have been writing for nearly two years has finally taken shape. This series of articles includes Python basics, standard library, and Django framework. The following articles cover the most important aspects of Python...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn