Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
8481 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
úno 16
4112
0
kvě 20
4569
0
říj 24
5185
1
dub 17
5176