开发者

Save image in python 3.1

I have image da开发者_StackOverflow中文版ta in buffer I want to save image in my computer by don't use library. (I use python 3.1) Thank you so much.


Okay, in python 3.x the built in open function is aliased to io.open so you can do ( assuming you have image data stored in imagedata)

filename = "image.png"  # use suitable extension according to the format of the image
f = open(filename, 'w') # first argument is the filename
f.write(imagedate)
f.close()

Now the image will be saved in the local directory with file name image.png.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜