base64转图片


import base64
import requests
import sys


url = sys.argv[1]
outName = sys.argv[2]

response = requests.get(url, timeout=20)

data = base64.b64decode(response.text.replace("data:image/jpeg;base64,","").replace("+",'#').replace('/',"+").replace('#',"/").replace("\n",""))

with open(outName, 'wb') as f:
    f.write(data)

你可能感兴趣的:(base64转图片)