跳至內容
選單
此問題已被標幟
1 回覆
8079 瀏覽次數

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
3663
0
5月 20
4052
0
10月 24
4582
1
4月 17
4632