[Python]圖片轉成base64碼 malagege included in Python 2014-11-20 28 words One minute Contents 實作異常的順力^^ 1 2 3 4 5 6 7 import base64 fp = open("a.jpg","rb") img = fp.read() fp.close() print(base64.b64encode(img)) 在接下來使用requests來實作 1 2 imgdata = requests.get(imgurl).content imgb64 = base64.b64encode(imgdata) 完成:D Please enable JavaScript to view the comments powered by Disqus.