python url编码与解码
上代码
#codeing:utf-8
from urllib import parse ori_url_10='http://192.168.0.10:3080/asg/portal.do?call=230&json={"pri":{"search_key":"","f":"f1,f2,f3,f4,f5,f7,f9,f10,f11","sadu":"0","apkversion":"1","imeibak":"868805034766728,868805034854508,A000008C057C25","isInsHwSevice":true,"utd_id":"Wt1InLx\/qxUDAETE+FTqwQkW","czip":"0","supportLoginWay":["QQ","WECHAT","SINA","PHONE_NUM_VERIFY","HUAWEI",null,"GEYAN"],"isLogin":"2","appSign":"09a448c68f8502610a48287073621e9c","clip_info":"","sourceIp":"http:\/\/192.168.0.10:3080\/asg\/portal.do","bookHero":"","v":"1","rCode":"3973004","vtv":"9","bidReqCount":3,"android_id":"441c3a1de1b2ad7d","payDexTime":"2019-04-23 20:20:34","installHours":0},"pub":{"clientAgent":"svnVer_1909051616","city":"%E4%BA%B3%E5%B7%9E%E5%B8%82","sign":"ba8e936e5991211c5664bce09d063c1f","screen":"720x1206","appCode":"f002","imsi":"dz_1567589819625","deviceId":"dz4fb51a4614604ad185d390bb40101f00","lsw":"2","apiVersion":"3.9.7.3004","province":"%E5%AE%89%E5%BE%BD%E7%9C%81","model":"ALP-AL00","brand":"HUAWEI","apn":"wifi","channelCode":"Google","dzPaySupport":"2","os":"android28","pname":"com.ishugui","utdid":"Wt1InLx\/qxUDAETE+FTqwQkW","en":"{\"adsdk\":\"1\",\"geyan\":\"1\"}","channelFee":"Google05","userId":"","p":"59","subPline":"2","afu":"0","cmTel":"","v":"4","imei":"868805034766728","macAddr":"E4:A7:C5:08:8C:5B"}}' print('----------------------ori_url\n',ori_url_10) #decode解码
urldecode=parse.unquote(ori_url_10)
print('----------------------urldecode\n',urldecode) #encode编码
urlencode=parse.quote(urldecode)
print('----------------------urlencode\n',urlencode) #批量处理
urldecodes=[]
#encode编码
with open("d:/url.txt") as fr:
lines=fr.readlines()
i=1
for line in lines:
print('----------------------ori_url\n',line)
print('正在进行%d 个'%i)
i=i+1
urldecode=parse.unquote(line) urldecodes.append(urldecode) print(urldecodes)
#decode解码
with open("d:/url_decode.txt","w+") as fw:
#fw.writelines(urldecodes) for i in range(len(urldecodes)):
fw.write(urldecodes[i])
fw.write('\n')
print('已经写入文件。')
python url编码与解码的更多相关文章
- python url编码,解码
>>> urllib.unquote('%E4%B8%BD%E6%B1%9F') >>> data '\xe4\xb8\xbd\xe6\xb1\x9f' >& ...
- python中的URL编码和解码
python中的URL编码和解码:test.py # 引入urllib的request模块 import urllib.request url = 'https://www.douban.com/j/ ...
- python接口自动化测试十三:url编码与解码
# url编码与解码 from urllib import parse url = 'http://zzk.cnblogs.com/s/blogpost?Keywords=中文' a = '中文' b ...
- Web开发须知:URL编码与解码
通常如果一样东西需要编码,说明这样东西并不适合传输.原因多种多样,如Size过大,包含隐私数据,对于Url来说,之所以要进行编码,是因为Url中有些字符会引起歧义. 例如,Url参数字符串中使用key ...
- java中的url 编码与解码
什么是application/x-www-form-urlencoded字符串? 答:它是一种编码类型.当URL地址里包含非西欧字符的字符串时,系统会将这些字符转换成application/x-www ...
- Python的编码和解码
Python的编码和解码 在不同的国家,存在不同的文字,由于现在的软件都要做到国际化通用,所以必须要有一种语言或编码方式,来实现各种编码的解码,然后重新编码. 在西方国家,没有汉字,只有英文,所以最开 ...
- LR URL编码和解码方法
问题:URL=http://www.baidu.com/s?wd=%E6%B5%B7%E6%B7%80%E9%BB%84%E5%BA%84"中要对%E6%B5%B7%E6%B7%80%E9% ...
- Oracle url编码与解码
Oracle url编码与解码 CreateTime--2018年3月30日17:26:36 Author:Marydon 一.url编码 实现方式:utl_url.escape() 说明:utl ...
- Delphi编码与签名【URL编码与解码,Base64编码与解码,MD5加密,HMAC-SHA1、HMAC-SHA224、HMAC-SHA256、HMAC-SHA384和HMAC-SHA512签名】
作者QQ:(648437169) 点击下载➨delphi编码与签名 [Delphi编码与签名]URL编码与解码,Base64编码与解码,MD5加密,HMAC-SHA1.HMAC-SHA224.HMAC ...
随机推荐
- IE8 indexOf
因为ie8中的js数组没有indexOf方法,所以使用之前要先加入这段js代码 if (!Array.prototype.indexOf) { Array.prototype.indexOf = fu ...
- (55)C# windows 消息
窗体捕获消息 namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeC ...
- 7-4 IP思考
内网ip和公网Ip 什么是内网IP: 一些小型企业或者学校,通常都是申请一个固定的IP地址,然后通过IP共享(IP Sharing),使用整个公司或学校的机器都能够访问互联网.而这些企业或学校的机器 ...
- qcom_IMS_conference_call小结
1conference call建立 用QXDM抓qcom log: 1.拨号盘*#*#825364#*#* , 进入抓log UI 2.Connectivity-->USB Port ...
- Qt 打开指定网站/系统文件夹
本文转载自:http://blog.csdn.net/robertkun/article/details/7802977和http://hi.baidu.com/xyhouse/item/ccf ...
- requests返回页面乱码
req=requests.post(domain,params,json=None) req=req.content.decode()
- Neo4J(Cypher语句)初识
欢迎各路大神临幸寒舍 以下节点标签为people,friend,用户自己也可以设置成其他标签,查询时需要用到标签.这个标签可以类比为关系数据库中的表名 创建节点.关系 创建节点(小明):create ...
- org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported
最后找到我的问题,springmvc配置文件中没加 <mvc:annotation-driven/> java代码: @RequestMapping(value="/reques ...
- 2018-8-10-win10-uwp-dataGrid
title author date CreateTime categories win10 uwp dataGrid lindexi 2018-08-10 19:16:51 +0800 2018-2- ...
- ubuntu 下 使用 Git 维护 linux kernel版本
学习linux内核一段时间,意识到内核的版本需要严格控制.利用Git工具可以很轻松的完成不同开发人员不同模块之间的代码融合与版本控制 . 1. 首先,安装Git .可以参考廖雪峰的博客 https: ...