Python walkthrough of using BeautifulSoup to crawl div tags

Source: Internet
Author: User
This article mainly introduces the Python 3 using BeautifulSoup Fetch P tag method, the text gives the detailed sample code for everyone to reference the study, to everyone has a certain reference learning value, needs of friends below to see together.

Objective

This article is mainly about Python 3 with BeautifulSoup Fetch p Tag Method example, share out for everyone to refer to the study, below to see the detailed introduction:

Example code:

#-*-Coding:utf-8-*-#python 2.7#xiaodeng#http://tieba.baidu.com/p/2460150866# label operation from BS4 Import Beautifulsoupimport Urllib.requestimport re# If it is a URL, you can use this method to read the page #html_doc = "http://tieba.baidu.com/p/2460150866" # req = Urllib.request.Request (html_doc) #webpage = Urllib.request.urlopen (req) #html = Webpage.read () html= "" "

"Recommended"

1. Python uses BeautifulSoup to implement crawlers

2. Using Python to implement asynchronous agent crawler and Agent pool method

3. A detailed description of Python crawler using proxy proxies crawl Web page method

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.