There is a certain foundation. How to Learn python?

Source: Internet
Author: User
Tags django tutorial
Hello, I have some python basics. He has been working on rubyonrails. But I don't like ruby because it is too flexible and I like python very much. I just don't think it is more strictly prohibited. Now I use htmlcssjs to write a small blog with django, but I don't think I have a good foundation. I 'd like to ask your comments. How can I learn python later? Hello, I have some python basics. We have been working on ruby on rails. But I don't like ruby because it is too flexible and I like python very much. I just don't think it is more strictly prohibited. Now I am an html css js user. I wrote a small blog with django, but I don't think I have a good foundation. I would like to ask your comments. How can I learn python later? Reply: The following content is based on my nearly one year of Python learning experience. If not, please help me:

Pre entry
As a programming language, Python is very easy to get started with. If you have C/C ++/Java experience, it will take minutes to get started. I already have questions about how to get started. Too many similar problemsIn addition, a BeginnersGuide page is maintained on the Python wiki. Is not described in detail here.

Goals to be achieved:
  1. More than 5 kb of code.
  2. Familiar with common coding convention and has practiced pep8.
  3. Familiar with Standrad Library (the requirement is not high. You can check the document ).
  4. Keep learning enthusiasm.

Getting started and in-depth
At this point, the reader should have a certain degree of understanding of Python. At least he has already reviewed the teaching material and can write a little simple code, for example, write a small blog or something in the Django framework (the subject's question reuse, get !). At this time, we should conduct an in-depth study on the official document, check for missing traps, and trace the source. The following are my strategies:
  1. Scan tutorial quickly. Skip this step if you have a solid foundation.
  2. Read the Data model in Language Reference.Note that you need to read the Data model of Python 2 and 3 at the same time to understand the differences between Python 2 and 3. In this step, you need to clarify the details in the Python Data Model, such as the attribute accessing mechanism, the meaning of special method, the details of descriptor, and the scenario and process of method creating. It should be noted that the explanation of the new-style class in the official document may be a bit obscure. If there is a reading barrier, you can try to read the New-style Classes.Information in the list.
  3. I believe that with step 3, you have a deep understanding of the objects in Python. At this time, you need to continue to read the rest of the Language Reference to learn more about the details of the Python Language.
  4. Review the Language Reference and scan the PEP documents.

After completing the above steps, even getting started with Python, there should be no major problems at the Python syntax level, and at least know how to solve the problems. The following is a large amount of Python-related resources. My suggestions are as follows:

  • Python Documentation IndexInAdditional documentationSection.
  • Python Cookbook (2rd for Py2 and 3rd for Py3 ).

At the same time, the amount of code should be increased.To https://pypi.python.org/pypiSubmit your Package!


Research

  • Study the source code of a large Python open-source project.
  • To study the implementation of CPython encoding, you can start with Python c api.
  • Coding! Coding!
  • )

Thank you for reading this article. If it is useful, please like it. If it is useless, please try it!

Concise Python tutorial: Concise Python tutorial
(Formerly known A Byte of Python: Https://swaroopch.com/notes/python/ )

It is hard to imagine that there are more appropriate tutorials than this book. Around 100 pages, covering Python's most important main line of knowledge, almost no nonsense.
It takes about three or four hours to complete code proficiency!
(I have provided an in-depth Python learning solution at the end of the book. Welcome to continue upgrading !)

Bytes ---------------------------------------------------------------------------------------------------------------------------

I had two detours when I learned Python myself.

1. Learn Python the Hard Way
2. Dive into Python


The first method takes a long time, slow in effect, and has no practical learning (you just learned to use it, not to learn it. It makes people feel like Chinese farmers have summed up their experiences in life and farming for thousands of years. Finally, they find that foreign researchers have come to the same conclusion over several months or years.

Method 2, Dive into PythonThere is no doubt that it is a good book. It is very careful and clear, but the bad is too much detail. The most important thing for the author is the knowledge of the entire framework, and then the details are supplemented in constant practice. Just like holding a copy C ++ PrimerI don't know how you feel when you get started with C ++ (of course, this book is far less abnormal than Primer ).

Bytes ---------------------------------------------------------------------------------------------------------------------------

This is the original sentence of the Chinese translation translator Mr. Shen jieyuan:
Swaroop C. H. Is the first teaching material I used to learn Python.
It is simple and clear, and can bring you into the world of Python in the shortest time.
It is not very long, but covers almost all important Python knowledge. When I first read this book, I deeply felt that this is an excellent teaching material for beginners of Python. It should be the first teaching material for every beginner of Python.

Welcome to the world of Python! I am a beginner, and I have a lot of knowledge. If there are any mistakes in the article, whether it's a text mistake or an understanding mistake, please leave a message to inform me, I must be grateful!

** Python classification under the series of articles, constantly updated, if you can't wait to see how to write first try this [Python Algorithms-C4 Induction and Recursion and ction] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-induction/ ) If you feel like you have been leaving a message for a long time, if you do not think it is good, simply turn off this blog website. Hey **

** [Thanks to @ Google fans for naming this series. I like it very much. It is called "The Story of codoon and snake"] **

1. Python Basics

[Python Basics] (http://hujiaweibujidao.github.io/blog/2014/05/10/python-tips1/ ) And [Python Advances] (http://hujiaweibujidao.github.io/blog/2014/05/16/python-tips2/ )

The former is a simple summary of Python BASICS (most from [online teacher @ Liao Xuefeng Python tutorial] (http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000) ), The latter recommends some good articles on advanced Python features (most from [bole online Python classification] (http://blog.jobbole.com/category/python/) ))

2. Python Data Structure

[Problem Solving with Python] (http://interactivepython.org/courselib/static/pythonds/index.html) ) [This URL link may be slow] When writing the reading records, of course, also combined with part of the [Introduction to algorithms] (http://en.wikipedia.org/wiki/Introduction_to_Algorithms) In addition, there are a lot of content on wikipedia, so there is a lot of content, it may be a bit messy. This section mainly introduces how to use Python to implement common data structures, such as stacks, queues, binary trees, and so on. It also provides Python's built-in data structure performance analysis, it also includes a brief summary of search and sorting (which will be described in more detail in the algorithm design article. Every article has implementation code with a lot of content. Simple algorithms generally give a general introduction to ideas and algorithm flows. complex algorithms provide various diagrams and code implementation details.

** This part is the first part of the algorithm design Article below. If the data structure is good, you can directly read the algorithm design article. If you have any problems, you can come back and check a specific content in the Data Structure Article to charge it, I personally think it is better to directly read the algorithm design article, because everyone's time is precious. If you will read these articles, it means you must have a certain foundation, the later part of the article on algorithm design is more about ideas. Here we are more about code. **

(1) [Search] (http://hujiaweibujidao.github.io/blog/2014/05/07/python-algorithms-search/ )

Briefly describe sequential search and binary search, and describe Hash search (Design of hash function and how to avoid conflicts)

(2) [sort] (http://hujiaweibujidao.github.io/blog/2014/05/07/python-algorithms-sort/ )

Briefly describe the ideas of various sorting algorithms and their illustration and implementation

(3) [data structure] (http://hujiaweibujidao.github.io/blog/2014/05/08/python-algorithms-datastructures/ )

Briefly describe the Performance Analysis and Implementation of Python's built-in data structure common data structures: Stack, queue, and binary heap

(4) [tree Summary] (http://hujiaweibujidao.github.io/blog/2014/05/08/python-algorithms-Trees/ )

Describe Binary Tree, and describe the thoughts and implementations of Binary Search Tree and AVL Tree.

3. Python Algorithm Design



Algorithm design is mainly to read [Python Algorithms: Mastering Basic Algorithms in the Python Language] (http://link.springer.com/book/10.1007%2F978-1-4302-3238-4) ) [** Click the link to enter the Springer free download original book electronic **] After writing the book summary, the original book most of the content combined with the classic book [algorithm Introduction] (http://en.wikipedia.org/wiki/Introduction_to_Algorithms) ), The content is more detailed, mainly introduces a variety of common algorithm design ideas, and how to use Python to efficiently and skillfully implement these algorithms. Here is different from the previous data structure article, some algorithms, such as sorting, do not detail their implementation details, but focus on their internal algorithm ideas. This part uses some third-party modules related to the data structure. Because this article focuses on the idea and implementation of algorithms, it does not re-implement each data structure, however, when introducing algorithms, we will analyze the advantages and disadvantages of Python's built-in data structure and third-party data structure modules, which means this article is much more difficult than above, however, I think my introduction should be simple and clear, because I use simple languages and do not list a bunch of properties and theorems like introduction to algorithms, I think about a problem step by step and the algorithm will come out. Hey hey, there are a lot of things about python development in addition to this. You can't miss it!

Every article here has implementation code, but I usually don't analyze the code. It is more about analyzing algorithm ideas, so there are more content, even so, it does not include all the content in the corresponding chapter of the original book. Because the content is too rich, I just choose a classic algorithm instance to introduce the core idea of the algorithm. In addition, there is still a lot of content that is not available in the original book, partly from the introduction to algorithms, and partly from my own insights. This article is a small dish for the great gods. Please smile, it may be a bit difficult for cainiao, so the most suitable one is similar to mine, I have some knowledge of various algorithms, but I still don't have a deep understanding of the half-bucket program. Hey hey.

The order of this article is based on the original book [Python Algorithms: Mastering Basic Algorithms in the Python Language] (http://link.springer.com/book/10.1007%2F978-1-4302-3238-4 ), To save time and maintain the original flavor, part of the content (generally difficult to translate and understand) directly extract from the original English content.

** 1. you may think that you know a lot about the content, but it is not necessary to read it. In fact, if it is me, I will also think so. But if it is just to sum up the steps of an algorithm, this summary is meaningless. I think the highlight of this summary is to find a way to clarify how an algorithm is created, what needs attention, and how to optimize it, the Q & A method is used to allow readers and me to come up with a solution to a specific problem. Each article will have one or two questions to answer later **

** 2. you may also say that the introduction to algorithms is not both authoritative and comprehensive. Basically, every algorithm has a detailed proof. Isn't it better to read the introduction to algorithms? Of course, if you want to read the introduction to algorithms, I will not stop you. After reading the introduction, I feel like you are not good at all. Don't blame your younger brother for not reminding you, the right theorem of the left nature is not suitable for algorithm science, and few people can stick to it. But there are not many stories about codoon and snakes **

** 3. If you carefully read this series, I promise you will have a lot of GAINS. I will give you a prompt when you need to look at the part of the introduction to algorithms. Note: the first three sections are about the basic knowledge, so the wonderful content starts from section 4th, and the wonderful content is from ~ **

(1) [Python Algorithms-C1 Introduction] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-introduction/ )

This section briefly introduces the content in the original book, describes the importance of algorithms and the summary of each chapter.

(2) [Python Algorithms-C2 The basics] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-the-basics/ )

** This section describes three methods: Representation of the algorithm's approximate running time, six algorithm performance evaluations, and implementation of the tree and graph in Python. **

(3) [Python Algorithms-C3 Counting 101] (http://hujiaweibujidao.github.io//blog/2014/07/01/python-algorithms-counting-101/ )

The original book mainly introduces some basic mathematics, such as arrangement and combination and recursive loops. However, this section only focuses on three methods for calculating the algorithm running time.

(4) [Python Algorithms-C4 Induction and Recursion and ction] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-induction/ )

** This section describes three core knowledge of Algorithm Design: Induction, Recursion, and Reduction. This is the focus and difficulty of the original book **

(5) [Python Algorithms-C5 Traversal] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-traversal/ )

** This section describes the graph Traversal Algorithms BFS and DFS, as well as the Topology Sorting method and the (strong) graph-searching algorithm **

(6) [Python Algorithms-C6 Divide and Combine and Conquer] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-pide-and-combine-and-conquer/ )

** This section mainly introduces the divide and conquer policy, and mentions the balance of the tree problem and the Sorting Algorithm Based on the divide and conquer policy **

(7) [Python Algorithms-C7 Greedy] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-greedy/ )

** This section describes the greedy policy through several examples, including the knapsack problem, the Harman encoding, and the minimal spanning tree **

(8) [Python Algorithms-C8 Dynamic Programming] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-dynamic-programming/ )

** This section describes the implementation methods of the Memorandum and iterative method of dynamic planning based on some typical dynamic planning issues, and compares the two methods **

(9) [Python Algorithms-C9 Graphs] (http://hujiaweibujidao.github.io/blog/2014/07/01/python-algorithms-graphs/ )

** This section mainly introduces various Shortest Path Algorithms in graph algorithms and reveals their kernels and similarities and differences from different perspectives. ** you have to admit that Python is a niche language, although it is widely used in foreign countries, there are still few materials in China. The author said that a small Blog written with Django is an Example in Django by Example! However, after completing this tutorial, I don't want to read this tutorial any more, because this tutorial encapsulates many general views and makes the class-based views that are hard to understand more abstract. I think after the example in the official document is completed (the Chinese version of 1.5 is 5, and the English version of 1.6 is 6), you can learn: How to Tango with Django: A Python Django Tutorial This book.
This book has three advantages. First, it uses a large project instance and 10 chapters to explain each part, so that learners can fully understand every step of Django development. There are also a lot of references to official documents to help readers get familiar with the structure of official documents (I won't say that the Django official document is printed into PDF with more than 1300 pages, and that official example only occupies a small part ~ Getting familiar with these documents is a very time-consuming task ).
The second advantage is that the view part of this book only applies to function-based views and shortcuts (this project construction method is also done in the first three sections of the official documentation, the general view used for project reconstruction in section 4 is not easy to understand .), This method is more underlying for Django and can be intuitively reflected in the Code. The view Part processes model data and how to render the template helps to deepen understanding of Django's MTV model. I made two official examples at the beginning, and read some common view modules to find out what the general view actually did. Although the model also encapsulates ORM (Object link ing), after all, we can manually query the database content, and Django also provides QuerySet to query the database, which is not difficult to understand. The general view is really hard to understand without looking at the source code. Therefore, it is a good way to put aside the general view when you are a beginner, if you are familiar with the working principle of the view, it is not difficult to reconstruct it.
The third advantage is that this book expands the functions of Django, such as adding search engine support, introducing the bootstrap front-end framework, explaining jQuery and JAJX, and explaining South (database migration ), these things are all things that may occur during web development. The last book also announced that the next version will add Test-driven development, and provided the main references in advance, it also guides readers to continue learning.
I strongly recommend that you learn this book. I have benefited a lot since I learned it. If you are familiar with the examples of official documents, you can skip the first three chapters, starting from Chapter 4 or even chapter 5, it will save some reading time. Although the number is in English, it is not long. It only takes me 2-3 days to finish reading ~ We have also completed the sample program ~

The official Python documentation is of excellent quality. Moderate length and clear examples. I think Python can be widely used. So if you want to learn it, you should read the official documentation. After reading it, you will know what to do later.

View More
View documents and source code
Write more
I keep adding a function to your blog and try to add various modules, plug-ins, and tools. It is not for this blog, but for the sake of exercise, the source code of the standard library is mounted. It's amazing. I cannot.

Supported by @ Zhang Guangyi Concise Python tutorial
In addition, we strongly recommend a long-history python game, the python challenge
The Python Challenge
This is why I have mastered and liked Python. The official Python documentation is of excellent quality. The length is moderate and the example is clear. You will know what to do later. Python Training Here is a teaching video, which is recommended. Language is just a tool, not very difficult. It is recommended that you exercise more frequently. The most important thing is the actual project. exercise in the actual project, which is the fastest growing.
Recommended python learning site: http://www.pythontab.com
Python: http://bbs.pythontab.com When reading and practicing, you should learn fast and recommend a good book:
Programming Python, 4th Edition Free Download

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.