【笔记】Python3实现URL编解码

前言

Python3实现URL编解码

requests

URL编码

<str>:未编码的字符串

1
2
3
import requests

requests.utils.quote(<str>)

URL解码

<str>:已编码的字符串

1
2
3
import requests

requests.utils.unquote(<str>)

urllib

URL编码

<str>:未编码的字符串

1
2
3
import urllib

urllib.parse.quote(<str>, 'utf-8')

URL解码

<str>:已编码的字符串

1
2
3
import urllib

urllib.parse.unquote(<str>, 'utf-8')

完成

参考文献

CSDN——桥路丶