转码类
图片转Base64
import base64
f = open("./path/to/a.jpg", 'rb')
base64_data = base64.b64encode(f.read())
s = base64_data.decode()
字符串&json
import json
# 将json字符串转换成dic字典对象
dict_json = json.loads(json_response)
# 将字典转换成json字符串
str_json = json.dumps( dict_json )