request

 import requests
 newsurl = ‘https://news.sina.com.cn/’
 response = request.get(newsurl)
 type(response)
 # requests.models.Response
 type(response.text)
 # str

urllib

 import urllib
 response = urllib.response.urlopen(’http:php.net’)
 response.encoding=‘utf-8’ # 改变编码方式
 type(response)
 # http.client.HTTPResponse
 html = response.read()
 type(html)
 # bytes

Notebook   Python     

本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!

MultiProcessing 上一篇
课堂笔记-数据挖掘 下一篇