爬虫-urllib-urlopen

Posted 七度王爵

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了爬虫-urllib-urlopen相关的知识,希望对你有一定的参考价值。

初学爬虫,整理一些相关知识,方便查询

1、urlopen

语法:

resp = request.urlopen(url)

#读取所有内容

resp.read()

#读取指定n个内容

resp.read(n)

#读取一行内容

resp.readline()

#所有内容以行的形式读取

resp.readlines()

#获取状态码

resp.getcode()

待续...

以上是关于爬虫-urllib-urlopen的主要内容,如果未能解决你的问题,请参考以下文章

Python爬虫|网络爬虫简介

Python爬虫|网络爬虫简介

Python爬虫|网络爬虫简介

爬虫篇 | 高级爬虫:Scrapy爬虫框架的安装

Python3爬虫 爬虫与反爬虫

求编程大佬 Python 爬虫