1
【笔记】Python实现URL编解码
source link: https://loli.fj.cn/2023/03/04/Python%E5%AE%9E%E7%8E%B0URL%E7%BC%96%E8%A7%A3%E7%A0%81/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
【笔记】Python实现URL编解码
2023-03-04
Python实现URL编解码
requests
URL编码
<str>
:未编码的字符串
import requests
requests.utils.quote(<str>)
URL解码
<str>
:已编码的字符串
import requests
requests.utils.unquote(<str>)
urllib
URL编码
<str>
:未编码的字符串
import urllib
urllib.parse.quote(<str>, 'utf-8')
URL解码
<str>
:已编码的字符串
import urllib
urllib.parse.unquote(<str>, 'utf-8')
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK