base64编码超长的情况下。解码问题

第一种解码的方式

import base64

strg = data[6]
lens = len(strg)
lenx = lens - (lens % 4 if lens % 4 else 4)
try:
result = base64.decodestring(strg[:lenx])
print(result)
except:
pass



第二种解码的方式
dd = base64.b64decode(strg)
print dd



使用的第一种解码的方式。我发现数据中。少了一个“}”
使用第二种方式的解码。数据是完整的

纠正一下超长的字符串base64解码的问题。可使用第二种的方式

猜你喜欢

转载自www.cnblogs.com/xiaoxiao-niao/p/9050231.html