import base64, urllib.request #image = urllib.request.urlopen('http://docs.python.org/_static/py.png') #image_64 = base64.encodestring(image.read()) #이미지 읽기 tt = open('c:/tt.jpg','rb') btt = base64.encodestring(tt.read()) #파일쓰기 f = open("myimg.html", 'w') dec = btt.decode('utf-8') f.write('<img src = "data:image/gif;base64,' + dec + '">') f.close()