Python Learning Web page data acquisition

Source: Internet
Author: User

Because of the need to learn the machine learning content, learn that Python is easy to use in machine learning, and start learning, machine learning is now mainly learning "machine learning Combat" this book. Python is in the Mooc to learn the "play with Python data" this open class. You can then put the answers to the homework answers in the course.

To get web page data in Python, the following questions are required:

I'm using the Spyder development environment, and Python's version is 3.5. The code is as follows:

  

Importurllib.request#Python 3.5 forIinchRange (10): Response= Urllib.request.urlopen ('http://tieba.baidu.com/p/100000000%d'%(i)) HTML=Response.read ()Print(HTML) FR= Open ('100000000%d.html.txt'% (i),'WB') fr.write (HTML) fr.close ()

  

Python Learning Web page data acquisition

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.