Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
8404 Vues

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
Ignorer
Auteur Meilleure réponse

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Avatar
Ignorer
Publications associées Réponses Vues Activité
0
févr. 16
4072
0
mai 20
4563
0
oct. 24
5175
1
avr. 17
5159