Have a certain foundation, how to learn python?

Source: Internet
Author: User
Tags ruby on rails django tutorial
Hello, I have some Python basics. And I've been doing Ruby on rails. But I do not like Ruby because it is too flexible, or quite like python, only less feel he is more strictly forbidden. Now I am the HTML CSS JS will, with Django wrote a small blog, but I feel that their foundation is not good, I would like to ask you the opinion, how can I learn python after?

Reply content:

The following is based on my nearly a year of Python learning experience, if not enough, welcome to the righting:

Pre-entry
Python as a "good start" programming language, it is too good to get started, if you have C/c++/java experience, it is minute things. Questions about how to get started, know too many similar questions., and a Beginnersguide page is maintained on the Python wiki. , no detailed description is given here.

Objectives to be achieved:
    1. Code volume above 5k.
    2. Familiar with common coding convention, practice over PEP8.
    3. Familiar with the Standrad Library (requirements are not high, will check the documents on the line).
    4. Keep learning enthusiasm.

Getting Started and in-depth
In this step, the reader should have a certain degree of understanding of Python, at least have already brush the textbook, you can write a simple code, such as in the Django framework to write a small blog or something (the main question reuse,get! )。 At this time should be the official document to carry out an in-depth study, check gaps, traced back. Here are the strategies I used:
    1. Quickly sweep the tutorial again. If you have a solid foundation, you can skip this step.
    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 difference between 2 and 3. In this step, you need to figure out the details of the Python Data model, such as the attribute accessing mechanism, the meaning of the special method, the descriptor details, the method creating the scene and the process. It is important to note that the New-style class in the official documentation may be a bit obscure, and if there is a reading disorder, try reading the data in the New-style Classes list.
    3. Believing in the 2nd step, you have a deeper understanding of the object in Python. At this point you need to continue reading the rest of language reference to learn more about the details of the Python language.
    4. Review language Reference and sweep THE PEP documents that appear.

To complete the above steps, basically even if you are getting started Python, you should not have a big problem with Python's syntax, and at least know how to solve the problem. Here are a lot of resources to read about Python, and here are my suggestions:

    • Python documentation The Additional documentation subsection in Index.
    • Python Cookbook (2rd for Py2 and 3rd for Py3).

At the same time, the amount of code to be put up. Submit your package to https://pypi.python.org/pypi !


Study

    • Study the source code of Python's large open source project.
    • Study the coding implementation of CPython, which starts with the Python C API.
    • coding! coding!
    • ... (I can't do it anymore, I'm still in the process of brushing REFERENCE/PEP doc)

Thank you for reading, such as useful, please praise, if useless, please spray it!

"Concise Python Tutorial": Concise Python Tutorial
(English formerly known as A Byte of Python: https:// Swaroopch.com/notes/pyt hon/ )

I can hardly imagine a more suitable introductory tutorial than this book. Around 100 pages, covering Python's most important mainline knowledge point, almost no nonsense.
Code skilled workers about 3, 4 hours can be done, a sense of accomplishment!
(at the end of the book you'll learn more about Python, and you are welcome to upgrade!) )

--------------------------------------------------------------------------------------------------------------- ------------

I took a detour two times when I taught myself to python myself.

1. Learn Python the hard
2. Dive into Python


The first method takes a long, slow, and ineffective study (you just learned to use it, not to learn it) and it's hard to hold on. It feels like the experience of thousands of years of Chinese farmers ' life and farming, and finally found that the abstract generalizations of foreign researchers for months or years draw the same conclusion.

The second method, Dive into PythonA good book is no doubt, very careful and clear, but bad is bad in too many details. The most important thing for the beginner is the knowledge of the whole framework, and then add the details in the ongoing practice. It's like holding a copy. C + + PrimerTo get started C + + I don't know how you'll feel (of course, this book is far from primer so sick).

--------------------------------------------------------------------------------------------------------------- ------------

This is the exact words of Mr. Shen Jieyuan, the translator of Chinese translator:
The
Book of Swaroop C. H is the first textbook I learned when I was studying python.
It is simple and clear and can lead you into the world of python in the shortest possible time.
It's not very long, but it covers almost all of the important Python knowledge. When I first read the book, I felt deeply that it was a very good textbook for Python beginners and should be the first textbook for every Python beginner.

You are welcome to join the world of Python! I Caishuxueqian, most of the learning, so the article if there is a mistake, whether it is a clerical error or misunderstanding, please leave a message to inform, I will be grateful!

**python categories under the series of articles, constantly updated, if you can't wait to see how it is written can first try this [Python algorithms-c4 induction and recursion and Reduction] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-induction/ ), if you feel a long time message to praise Bai, if you feel bad, then directly turn off this blog site, hey * *

**[thanks to @google enthusiasts to the name of the series, I like it, called the "Code farmer and the story of the Snake"]**

1.Python Basic Knowledge Chapter

[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 (mostly from [online mentor @ Liaoche's Python tutorial] ( http://www. liaoxuefeng.com/wiki/00 1374738125095c955c1e6d8bb493182103fac9270762a000 ), the latter recommended some good articles on Python advanced features (most of which are excerpted from the [Bole Online python classification article] ( / http Blog.jobbole.com/catego ry/python/ ))

2.Python Data Structure Chapter

The data structure is mainly read [problem solving with Python] ( / http interactivepython.org/c ourselib/static/pythonds/index.html ) [the URL link may be slower] when writing down the reading record, of course, also combined with some [algorithm introduction] ( / http en.wikipedia.org/wiki/i ntroduction_to_algorithms In addition, there are many Wikipedia content, so the content is more, may be a bit messy. This section mainly describes how to use Python to implement some commonly used data structures, such as stacks, queues, binary trees, and so on, as well as Python's built-in data structure performance analysis, but also includes a search and sorting (in the algorithm design article will be more detailed introduction) of a simple summary. Each article has implementation code, the content is more, simple algorithm is generally introduced under the idea and algorithm flow, complex algorithm will give a variety of illustrations and code implementation detailed introduction.

* * This part is the following algorithm design chapter, if the data structure is also good can directly see the algorithm design, encountered problems can come back to see the data structure of a specific content of the charge, I personally think that the direct reading algorithm design is better, because everyone's time is more valuable, If you will read these articles that you must have a certain basis, the algorithm behind the design of more ideas, here is more code just, hey. **

(1) Search ( / http Hujiaweibujidao.github.io /blog/2014/05/07/python-algorithms-search/ )

Describe the order lookup and binary search, detail hash lookup (design of hash function and how to avoid conflict)

(2) Sort ( / http Hujiaweibujidao.github.io /blog/2014/05/07/python-algorithms-sort/ )

The idea of various sorting algorithms and its diagram and implementation are described.

(3) Data structure ( / http Hujiaweibujidao.github.io /blog/2014/05/08/python-algorithms-datastructures/ )

A brief introduction to the performance analysis and implementation of Python's built-in data structures: stacks, queues, and two fork heaps

(4) [Tree Summary] ( / http Hujiaweibujidao.github.io /blog/2014/05/08/python-algorithms-trees/ )

A brief introduction to binary tree and the idea and realization of binary search tree and AVL tree

3.Python Algorithm Design Chapter



The algorithm design article is mainly read [Python algorithms:mastering Basic algorithms in the Python Language] ( / http link.springer.com/book/ 10.1007%2f978-1-4302-3238-4 ) [* * Click on the link to enter springer free download original book electronic version * *] After the reading summary, the original book most of the content combined with the classic book [Algorithm introduction] ( / http en.wikipedia.org/wiki/i ntroduction_to_algorithms ), the content is more detailed and thorough, mainly introduces a variety of commonly used algorithm design ideas, and how to use Python to implement these algorithms efficiently and skillfully, here is different from the previous data structure, some algorithms such as sorting will not detail its implementation details, but focus on its internal algorithm thinking. This section uses a number of third-party modules related to data structures, because this focus is on the idea and implementation of the algorithm, so there is no way to re-implement each data structure, but the introduction of the algorithm will analyze the python built-in data structure as well as the advantages and disadvantages of the third-party data structures module, Also means that the article is more difficult than before, but I think my introduction should be simple and clear, because I use a relatively plain language, and not like the introduction of the algorithm as a list of properties and theorems, mainly on a certain problem step-by-step thinking and then the algorithm came out, hey, besides, There is also a lot of content about Python development, wonderful really not to be missed!

Here every article has implementation code, but the code I generally do not analyze, more analytical algorithm ideas, so the content is more, even so does not include the original book corresponding to all the content, because the content is too rich, so I just choose Classic algorithm example to introduce the core idea of the algorithm, in addition, There is a lot of content is not the original book, part is from the introduction of the algorithm, part is from my own sentiment, hehe. This article for the Great God is a side dish, please a smile, for the rookie may be a bit difficult to chew, so the most suitable is similar to my level, the algorithm has some understanding but understanding is not deep half bucket of water program ape, hey.

The order of this article follows the original book [Python algorithms:mastering Basic algorithms in the Python Language] ( / http link.springer.com/book/ 10.1007%2f978-1-4302-3238-4 Chapters to be arranged (the same part of the section headings are different yo), in order to save time and maintain the original flavor, some content (generally more difficult to translate and understand content) directly from the original English content.

**1. You may think a lot of content you know, do not see the need, in fact, if it is my words I will think so, but if it is only a summary of the steps of an algorithm, then this conclusion is meaningless, I think the highlight of this summary is to find a way to explain how an algorithm is thought out, there are what needs attention , how to optimize and so on, using a question-and-answer way to let the reader and I come up with a solution to a problem, after each article there are one or two small questions practiced hand yo * *

**2. You may also say that the introduction of the algorithm is not both authoritative and comprehensive, and basically every algorithm has a detailed proof of the introduction of the algorithm is not better, of course, if you want to read the introduction of the algorithm I do not stop you, read the feeling that the whole person is not good do not blame the younger brother did not remind you yo, hehe Left a property right a theorem is not suitable for the algorithm of popular science, not many people can persist in reading. But the story of the farmer and the snake is not much, oh oh * *

**3. If you read the series, I promise you will have a lot of harvest, need to see the introduction of the algorithm which part of the place I will give hints, hey. Warm tips, the previous section is a basic knowledge of the introduction, so wonderful content from the 4th quarter, Yo, O (∩_∩) o~**

(1) [Python algorithms-c1 Introduction] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-introduction/ )

This section is mainly about the contents of the original book to do some brief introduction, explain the importance of the algorithm and the contents of each chapter summary.

(2) [Python ALGORITHMS-C2 the basics] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-the-basics/ )

* * This section mainly introduces three content: algorithm asymptotic running time representation method, six algorithm performance evaluation experience, and Python tree and graph implementation way. **

(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 permutation and recursive loop, but this section only focuses on the calculation algorithm running time of three ways

(4) [Python ALGORITHMS-C4 Induction and recursion and Reduction] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-induction/ )

* * This section mainly introduces the three core knowledge of algorithmic design: Induction (derivation), recursion (recursion) and reduction (Statute), which is the key and difficult part of the original book * *

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

* * This section mainly introduces the traversal algorithm of the graph BFS and DFS, and another solution to the topological ordering and the algorithm for finding the (strong) connected component of the graph * *

(6) [Python algorithms-c6 Divide and Combine and conquer] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-divide-and-combine-and-conquer/ )

* * This section mainly introduces the strategy of divide and conquer, mentions the balance of tree shape problem and ranking algorithm based on divide and conquer strategy * *

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

* * This section mainly through a few examples to introduce the greedy strategy, mainly including knapsack problem, Huffman coding and minimum spanning tree and so on * *

(8) [Python algorithms-c8 Dynamic Programming] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-dynamic-programming/ )

* * This section mainly combines with some classical dynamic planning issues to introduce the two ways of implementing the memo and iteration methods of the dynamical programming, and compare the two approaches.

(9) [Python algorithms-c9 Graphs] ( / http Hujiaweibujidao.github.io /blog/2014/07/01/python-algorithms-graphs/ )

* * This section mainly introduces the various shortest path algorithms in the graph algorithm, revealing their cores from different angles and their similarities and differences * * have to admit that Python is a small audience of the language, although the foreign application is widespread, but the domestic data is relatively small, the landlord said with Django written small blog is Django By Example Example! However, it is generally not a good idea to look at this tutorial, because this tutorial encapsulates a lot of common views and makes it difficult to understand class-based views more abstract. I think the official documents after the example is finished (1.5 of the Chinese version is 5, 1.6 of the English version is now 6 knots), can go to learn: How to Tango with Django:a Python Django Tutorial The book.
This book has 3 benefits, first it uses a large project example, using 10 chapters to explain the various parts, can fully let the learners understand the Django development of each link. And there are a number of references to official documents that can help readers familiarize themselves with the structure of official documents (I wouldn't say that Django official documents are printed into PDFs with more than 1300 pages, and that official example is a very small part of it-it's a time-consuming task to familiarize yourself with these documents).
The second benefit is that the view portion of the book only applies to function-based views, as well as some shortcuts (which are also done in the first 3 sections of the official documentation, followed by a general view of the project refactoring in section fourth, from which the class-based view is really not easy to understand.) , which is more basic to Django, can be visually reflected in the code, how the view section handles model data, and how templates are rendered, helping to deepen the understanding of Django's MTV model. I've done two official examples in my beginner's, and I've seen a few common view modules to figure out what the generic view does. Although the model also encapsulates ORM (object-relational mapping), after all, we can manually query the contents of the database, and Django also provides queryset to query the database, compared to the part of the model is not difficult to understand. General view really do not look at the source code is very difficult to understand, so in the first time to shelve the general view, and to use a function-based view is a good way to do, and so familiar with the view of the working principle of refactoring is not difficult.
The third benefit is that the book expands on Django features, such as adding search engine support, introducing the bootstrap front-end framework, explaining jquery and JAJX, and explaining South (database migration), something that will be encountered in web development, The final book also predicts that the next edition will increase test-driven development, and give the main references in advance, and also guide the reader in the direction of further learning.
I strongly recommend studying this book, I learned after the benefit, if the official documents are familiar with the example, you can skip the first 3 chapters, from the fourth chapter, or even the fifth chapter, will save some reading time, although the number is in English, but not long, I only spent 2-3 days to read ~ also finished the inside of the sample program ~

The official document quality of Python is very good. The space is moderate, the example is clear, I think Python can be widely used for this credit. So you want to learn to read the official documents Well, after reading you know what to do.

See more
Look at the document, see the source code
Write More
Constantly give you that little blog add features, try to add a variety of modules, plugins, tools, not for this blog, but to practice the standard library on the end of the source code, we are simply too cow. I can't do it anyway.

Support @ Zhang Guangyi mentioned "Concise Python Tutorial"
In addition, we recommend a long history of the Python game, the Python Challenge
The Python Challenge
This is the reason I can say I have mastered and like Python. The official document quality of Python is very good. The space is moderate, the example is clear, you will know what to do after reading it. Python Training Here is a tutorial video, recommended. Language is just a tool, not difficult. Who can be born skillfully, the proposal usually more practice, the important thing is the actual project, in the actual project exercise, this growth is the fastest.
Recommended Python learning sites: http://www. pythontab.com
Python Community: / http bbs.pythontab.com While reading while practicing, should learn fast, recommend a good book:
Programming Python, 4th Edition free Download
  • 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.