跳至内容
菜单
此问题已终结
1 回复
8061 查看

Hi, Everyone,

I used the code:

with open('z.jpg','wb') as f:
f.write(base64.b64decode(self.file))

the 'file' is the name of Binary field which have put a photo in, but I can't open the file (z.jpg) I have got correctly.

So, Are there anyone can modify this code and make it work?

形象
丢弃
编写者 最佳答案

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
形象
丢弃
相关帖文 回复 查看 活动
0
2月 16
3651
0
5月 20
4033
0
10月 24
4552
1
4月 17
4620