如题,现在转译后的结果为%2Fkns%2Fbrief%2Fbrief.aspx%3Fcurpage%3D17%26RecordsPerPage%3D20%26QueryID%3D0%26...请问有什么办法可以将%2F变为%2f呢?
1 回答
月关宝盒
TA贡献1772条经验 获得超5个赞
In [1]: '%2Fkns%2Fbrief%2Fbrief.aspx%3Fcurpage%3D17%26RecordsPerPage%3D20%26QueryID%3D0%26'.lower() Out[1]: '%2fkns%2fbrief%2fbrief.aspx%3fcurpage%3d17%26recordsperpage%3d20%26queryid%3d0%26'In [2]: import re In [3]: regex = re.compile(r'%\d{1}[A-Z]{1}') In [4]: _ = '%2Fkns%2Fbrief%2Fbrief.aspx%3Fcurpage%3D17%26RecordsPerPage%3D20%26QueryID%3D0%26'In [5]: res = regex.findall(_) In [6]: res Out[6]: ['%2F', '%2F', '%2F', '%3F', '%3D', '%3D', '%3D'] In [7]: for i in res: ...: _ = _.replace(i, i.lower()) ...: In [8]: _ Out[8]: '%2fkns%2fbrief%2fbrief.aspx%3fcurpage%3d17%26RecordsPerPage%3d20%26QueryID%3d0%26'
添加回答
举报
0/150
提交
取消