base64.b64decode这个函数的字符类型是什么?
0
在python2.7中打印输出是字符串
代码:python生成JSON串 然后编码 再解码 转换成字典
a={'responseErrorMsg' : 'Request error',
'responseResult' : 'Failed'}
b=json.dumps(a)
c=base64.b64encode(b)
d=base64.b64decode(c)
e=json.loads(b)
print b
print c
print e
print e['responseErrorMsg']
print type(c)
在自动化脚本中,函数返回 rly_msg为编码后的jason串,解压时报错是字符串,没有需要解码的jason串
json_zip = re.findall(r"{(.*)}", rly_msg)
json_decode=base64.b64decode(json_zip[0])
代码:python生成JSON串 然后编码 再解码 转换成字典
a={'responseErrorMsg' : 'Request error',
'responseResult' : 'Failed'}
b=json.dumps(a)
c=base64.b64encode(b)
d=base64.b64decode(c)
e=json.loads(b)
print b
print c
print e
print e['responseErrorMsg']
print type(c)
在自动化脚本中,函数返回 rly_msg为编码后的jason串,解压时报错是字符串,没有需要解码的jason串
json_zip = re.findall(r"{(.*)}", rly_msg)
json_decode=base64.b64decode(json_zip[0])
没有找到相关结果
重要提示:提问者不能发表回复,可以通过评论与回答者沟通,沟通后可以通过编辑功能完善问题描述,以便后续其他人能够更容易理解问题.
0 个回复