How can I learn Python efficiently and interestingly?

Source: Internet
Author: User
I recently started to learn the Python language, finished learning programming with my children, and finished reading the official tutorial. Now I am reading the Chinese version of "LearnPython". I feel that this book is too much about it. More like a reference book, my interest in learning is also reduced. I would like to capture some web pages, crawlers such as data capture, but feel that the foundation is not enough. experienced elders ask for advice (I am not a computer professional, but I am still very interested in this aspect, I can spend about two hours learning Python every day.) I recently started to learn the Python language, learned programming with my children, and read the official tutorial. Now I am reading the Chinese version of "Learn Python". I feel that this book is too much about it. More like a reference book, my interest in learning is also reduced. I Would Like To Crawl some web pages, crawlers such as data capture, but feel that the foundation is not enough. experienced elders ask for advice (I am not a computer professional, but I am still very interested in this aspect, I can take about two hours to learn Python every day.) reply: I am interested in reading books and will be consumed if I don't do it.
If you want to learn crawlers and worry about insufficient Foundation, try Scrapy first.
Take one day to repeat the document based on the progress of two hours every day.
Scrapy 0.24 documentation
Since the subject is not a computer Major, you may need to know the following:
  1. The basic knowledge of HTML tags. It is good to understand the meaning of tags.
  2. What are the messy terms of http basics, get, post, and json?
The above can be used in w3school online tutorials This website has a basic understanding.
If the above basic question subject already exists, you can find Douban or some other small websites and start to write a small crawler with reference to the document.
If you need to verify or use cookies, give up first. The first step is to focus on making crawlers run. This is also a way to maintain learning interest.
When you reach the point where you can write a crawler to crawl data as you like, you can consider optimization, anti-crawling, user verification, Cookie, simulated login, and multithreading to improve crawling efficiency...

At the beginning, I first put my hand under Douban, and wrote a small crawler to crawl 2nd of the books in the database in more than 1 million days, I don't know what to do with the data. (It is worth mentioning that Douban has a anti-crawling verification. If the crawling speed is too fast, you are required to enter the verification code to determine that you are not a robot. remember to set the latency, or your crawler will be annoying)

So I plan to crawl zhihu. I heard that zhihu anti-crawling is quite powerful (I tried to find zhihu IP segment before ), so I tried to go to a proxy pool to crawl through a highly anonymous proxy. I found a proxy on the Internet and bought the service for half a year. I found that all the mentioned proxies could not be connected, I felt too troublesome. I simply went to crawl the proxy myself. During this period, I felt that scrapy was a little cool on crawling the proxy. So I wrote a simple crawler using pycurl + beatifulsoup to crawl it, now some stable and free agents can be used in a short period of time. I feel like I can start crawling. at present, it only enables crawling someone's dynamics and sending emails to their mailboxes. Well, just like this old man did.
What are the cool, interesting, and useful things that can be achieved using crawler technology? -Answers from Wu Xinsheng

It took about 10 days to read the document from the beginning, during which most of the time was spent in data query. there are also unnecessary consumption such as writing or using the framework on your own, so don't think so much and decide to start directly in one direction. You will find that you think it is very difficult, A few days later, I thought it was not that difficult ~ I learned python during the winter vacation and started to write crawlers after just 10 days... While reading and reading other people's blogs, find the source code for analysis.
In the process of writing, you can find out what you lack, what you need to learn, how much you want to learn, and what the most important thing is to learn and what you can do.
After writing some simple crawlers and small scripts, I started to read the books in the system, because at this time I knew how to learn the system.
Targeted learning is much faster than aimless learning. After learning about the basic syntax, I began to try to write things, write a small game, and so on. Although it would be difficult, but it is more efficient than simply learning the python video of the Multi-fish C forum, which teaches you how to create a crawler to crawl pictures. There are also small projects compiled by many netizens in the Forum for reference. Web http://bbs.fishc.com
I recommend a book "Basic python tutorial". There are several small projects at the end of the book, which is very interesting to implement.
In short, learning programming languages is designed to solve practical problems in life. Instead of learning for the purpose of learning, you can have a steady stream of learning motivation. After mastering the basic syntax, I want to make an in-depth study of your interest. For example, I am interested in pygame and I wrote a plane-hitting game myself. 1. Reading English books a little
2. Type Electronic library. Download books free. Finding boooks in the browser.
3. Enter "with python" and press ENTER
4. Find the books you are interested in and click Download
5. Since you are interested in crawling web pages and have completed a book and an official tutorial, I think you can learn to crawl web pages. You don't have to think about it as complicated. I think you have the courage to read this book learn python. It's definitely not someone or something that forces you to capture webpages, why bother? The book is so thick. When you finish reading the lily, it will be cool. If it is not for the purpose of learning the language itself, it is recommended not to chew on it first. In addition, web page capturing is not just about learning this python course, but you may need to know other things.

I am also a python enthusiast, learning it is purely out of interest and occasionally can be used in learning. I only learned python for a few months. I also tried web page crawling. I feel that it is not so difficult to get started. As long as you have good English skills or frequently look up the dictionary, you can learn the official documents of the databases that crawl web pages. We recommend that you first learn about these libraries: requests, BeautifulSoup, and lxml. Then you can look at scrapy, and then I don't know.

Make progress together! Do some damage.
After reading so many things, you don't want to write anything?
From what?
1 crawler. You can search crawlers on zhihu to get a lot of interesting stories. Maybe you can get others' code.
2 robots. Here we refer to chat bot and social media website bot. For example, you can write a confession Wall Based on the wechat framework and Renren api. For example, you can write a confession Wall Based on xmpp to convert icq into a browser (by turning it over the wall ?) And so on. A chat room is implemented on a service that does not support group chat. When querying Public Weather accounts and using the chat room to open a dnd server (Dragon and underground), the code architecture will not be too big.
3. Create a website. The most frequently invented wheel is blog. No spof. However, this may require some js basics. Well, "a little" and "Basic" may be removed, maybe not.
4 fork. On which website did you find a good game? Fork one to try it out! If there are not enough artists, you can also get an interesting basic version of the game. For example, make a 2048 release.
5 kit. The tool is also a good choice. It is also 2048. It is not good to write a 2048 help program for heuristic search to determine which direction of the current status is more advantageous.

Hmm? You don't know how to do this? I have never learned it?
However, you have mastered most of Python, and the rest is not a Python issue.
What you need to learn is to collect information, such as a crawler tutor. In the google world, this is very simple, but in the world without Google, A more traditional method or a method to access Google may be required, which is simpler and hard to say.
What you need to learn is to analyze the requirements, break them down, and then analyze them so that they can only be arranged in the internal logic.
What you need to learn is to organize the Code. This Python may help you. It will be helpful to take a look at pep8.
From now on, books are no longer your teachers, but your tools. You will learn these things from various places and may not be able to find them everywhere, they may be in others' code, in others' Requirement documents, or even in your dreams.
Research, design, coding, refactoring, and programming are in place, and the world may be in place.
To continue writing, Kung Fu is already out of poetry. To get started with Python, we will first push "A Byte of Python". It will take A short time to finish reading it, and you will be able to write some small things after reading it. In practice, you can go online to find some instance reference and look at Python Manuals. As I said on the second floor, interest will be consumed in the course of reading books without actually doing anything. To learn a technology well, you need to hone your skills instead of just looking at it, experience can be found only from the actual work. If you really don't know how to implement the project practice, you can look at the usage of Paginator on the wheat College. In practice, this project can be slowly imitated and then become your own knowledge. First, let's get started with head first python, and then write a simple web. Then we can go deep into it based on our own research directions. If you have good code, remember to share it. You will feel a great sense of accomplishment when you look at the increase in downloads :)

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.