binascii.Error: Invalid base64-encoded string: number of data characters

 

 解决办法:

import base64

d = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAA".     # 模拟数据
# dd = d.split(",")[1]       # base64解成图片保存本地,需要吧data:base64协议给去掉
ret = base64.b64decode(d, altchars=None, validate=False)
print(ret)

 

posted @ 2021-12-21 15:31  WrYcF  阅读(6220)  评论(0编辑  收藏  举报
Live2D