关于Python爬虫入门(http请求 request和requests)

关于Python爬虫入门(http请求 request和requests)

1、urllib.request

#coding=utf-8

#welcome = "hello, jzh"
#print (welcome)

'''
测试爬虫
'''

import urllib.request
response = urllib.request.urlopen('https://chanpinxue.cn/about')
result = response.read().decode('utf-8')
print(result)

2、requests

import requests
url = 'http://chanpinxue.cn/about'
res = requests.get(url).text
print(res)

发表回复

您的电子邮箱地址不会被公开。