美文网首页
base64转图片

base64转图片

作者: 狼无雨雪 | 来源:发表于2021-08-05 18:16 被阅读0次
    
    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转图片

          本文链接:https://www.haomeiwen.com/subject/ftfvvltx.html