# 1、url编码

#先引入模块
from urllib.request import quote
ff = '摄像头'
ff = quote(ff)
print(ff)

2、url解码

# 解码是另一个模块
from urllib import parse
aa = '%E6%91%84%E5%83%8F%E5%A4%B4'
ret = parse.unquote(aa)
print(ret)