python base64和png或jpg图片转换 如何将获取到的base64数据转为png/jpg格式的图片: decoded = base64.decodebytes(string.encode("ascii")) with open("XX.png", "wb") as fh: fh.write(decoded