技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

python将图片转为base64编码

import base64

f = open("m1.jpg", "rb")
res = f.read()
s = base64.b64encode(res)

f = open("hello.txt","w")
f.write(s)

 

posted on 2014-10-22 11:26  codestyle  阅读(1984)  评论(0编辑  收藏  举报