北大青鸟:你需要的python爬虫笔记(12)

2021-02-21 08:32

Copy a network object denoted by a URL to a local file. If the URL points to a local file, the object will not be copied unless filename is supplied. Return a tuple (filename,

headers)where filename is the local file name under which

the object can be found, and headers is whatever the

info()method of the object returned by urlopen()returned

(for a remote object). Exceptions are the same as for

urlopen().

具体实现代码如下:

# -*- coding:utf-8 -*-

import time

from urllib import request

from bs4 import BeautifulSoup

import re

url = r'https://http://www.77cn.com.cn/question/22918070'

headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}


北大青鸟:你需要的python爬虫笔记(12).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2013—2014学年度第一学期教研计划

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: