Why can't the zero base get into the Python crawler's door? Is it so hard to do six lines of code? __python

Source: Internet
Author: User

May be the small series itself has a certain basis. Of course, I don't look down upon little white. Knowledge to get started a programming language is indeed relatively simple, and the small series itself is from the small white, but the first contact with the Python crawler really used a very short time, reptiles this kind of thing is more interested in, so it is more interesting to learn. Six lines of code can write a small crawler.

Save time, no nonsense introduced, directly on the example ... Enter the following code (a total of 6 lines)

Let's take a look at the data obtained

Here is to recommend my own building Python development Learning Group: 483546416, the group is learning Python development, if you are learning Python, small series welcome you to join, everyone is the software Development Party, not regularly share dry goods (only Python software development related), Including a copy of my own 2018 latest Python advanced materials and a high-level development tutorial, welcome to the step in and into the python's small partners

The reptile ends ~ ~ has the wood to be full of achievement feeling ...

The above code crawl is this page, the red box inside the data, that is, watercress film this week Word-of-mouth list.


The first step, the crawler URL, this ... Then the watercress bar, I do not know why the crawler to take the operation of the watercress-.

The second part, the content that needs to be crawled (data).

This is the last line in the top 6 lines of code, and it's probably the hardest part for beginners to find. This part of the code is getting the data.

Click on the mouse to crawl the data, here we point to "invisible guests", as shown in the figure.

Seeing things in the big red box is a lot like our most "important" code.

The reptile introduction finishes, you also should try Taker after reading.

Try climbing the "upcoming release."

is not feeling the reptile is very simple, already can.

In reality, reptiles are confronted with many problems, such as:

1. Page rules are not uniform;

2. Data processing to crawl down;

3. Anti-reptile mechanism.

There are many similar problems, want to deep into the great God, or need to step by step, 5 minutes to become big God is impossible ~ ~.

The top 6 lines of code include Python requests packets, HTML knowledge, XPath, and more. There is a lot of information on the Internet, here is no introduction.

is not very simple. Reptiles are really easy, and it's good to make some sense of accomplishment.

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.