Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
8392 Tampilan

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?

Avatar
Buang
Penulis Jawaban Terbai

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Feb 16
4071
0
Mei 20
4563
0
Okt 24
5174
1
Apr 17
5157