1.url转码解码
from urllib.parse import quote
import string
zhuanma = quote('这里放你要转码的对象', safe=string.printable)
jiema = urllib.parse.unquote('这里放你要解码的对象')
2.base64转码解码
def convertToBase64(self,infobase64):
tmpBytes = infobase64.encode()
tmpBase64 = base64.b64encode(tmpBytes)
return tmpBase64
def convertTostring(self,base64Info):
tmpBytes = base64.b64decode(base64Info)
tmpStr = tmpBytes.decode()
return tmpStr
page = ''
page_info = self.convertTostring(base64Info=page)
info_base64 = self.convertToBase64(infobase64=page_info)