首页 > 其他分享 >3.2 urllib.request发送get与post请求

3.2 urllib.request发送get与post请求

时间:2023-01-11 20:58:08浏览次数:41  
标签:get resp request urllib decode html

 

 --正常网页读取

import urllib.request

url='https://www.lingdianshuwu.com/'

#发送请求
resp=urllib.request.urlopen(url)    #这个网页只有get
html=resp.read().decode('gbk')   #decode将bytes类型转成str类型
print(html)

----网页输入账号密码读取

import urllib.request

url='https://www.lingdianshuwu.com/'

#发送请求
resp=urllib.request.urlopen(url)    #这个网页只有get
html=resp.read().decode('gbk')   #decode将bytes类型转成str类型
print(html)

  

标签:get,resp,request,urllib,decode,html
From: https://www.cnblogs.com/988MQ/p/17044865.html

相关文章