python终端下: import base64 >>> dict='{"name":"tom"}' >>> dict.encode() '{"name":"tom"}' base64加密: >>> base64.b64encode(dict.encode()) 'eyJuYW1lIjoidG9tIn0=' >>>