python爬虫把url链接编码成gbk2312格式过程解析
作者:淋哥 时间:2023-04-26 21:00:10
1. 问题抓取某个网站,发现请求参数是乱码格式,
这是点击 TextView,发现请求参数如下图所示
3. 那么=%B9%FA%CE%F1%D4%BA%B7%A2%D5%B9%D1%D0%BE%BF%D6%D0%D0%C4是什么东西啊
解码后是 =国务院发展研究中心
代码实现:
content = "我爱中国"
import urllib
res = urllib.quote(content.encode('gb2312'))
print res
print "11111111", type(res)
来源:https://www.cnblogs.com/xuchunlin/p/13052805.html
标签:python,爬虫,url,编码,gbk2312
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python itchat实现调用微信接口的第三方模块方法
2023-03-24 07:12:53
前后端分离和跨域问题的详细解决方案(CORS的原理)
2023-05-30 01:19:26
![](https://img.aspxhome.com/file/2023/7/55307_0s.png)
数据库查询的分页优化技巧
2009-05-17 10:31:00
Python使用reportlab将目录下所有的文本文件打印成pdf的方法
2022-01-23 11:36:11
Python实现图像随机添加椒盐噪声和高斯噪声
2023-06-13 22:54:36
![](https://img.aspxhome.com/file/2023/8/59458_0s.png)
golang grpc配置使用实战
2024-02-06 01:17:09
![](https://img.aspxhome.com/file/2023/5/109735_0s.png)
python如何判断文件存在方式
2023-01-23 12:58:37
Python高级特性与几种函数的讲解
2021-12-09 03:37:17
js中string和number类型互转换技巧(分享)
2024-05-05 09:14:53
Oracle 正则表达式实例详解
2024-01-25 23:43:01
MySQL select count(*)计数很慢优化方案
2024-01-23 21:31:24
![](https://img.aspxhome.com/file/2023/4/71714_0s.png)
django模板结构优化的方法
2023-11-12 11:57:02
修复 jQuery 中 isFunction 方法的 BUG
2010-01-25 12:05:00
sqlserver substring函数使用方法小结
2024-01-19 17:53:03
在Python程序中实现分布式进程的教程
2021-12-19 23:18:15
![](https://img.aspxhome.com/file/2023/5/76725_0s.png)
Python统计词频的几种方法小结
2023-10-22 05:35:41
vue实现动态控制el-table表格列的展示与隐藏
2024-05-05 09:07:26
![](https://img.aspxhome.com/file/2023/9/130849_0s.jpg)
Python提高运行速度工具之Pandarallel的使用教程
2021-07-16 20:14:09
![](https://img.aspxhome.com/file/2023/9/93699_0s.png)
Python实现简单的多任务mysql转xml的方法
2024-01-26 20:11:07
sublime text 3配置使用python操作方法
2023-01-21 20:30:14