Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
8084 Vizualizări

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?

Imagine profil
Abandonează
Autor Cel mai bun răspuns

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
feb. 16
3671
0
mai 20
4056
0
oct. 24
4594
1
apr. 17
4635