Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
8077 Widoki

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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lut 16
3660
0
maj 20
4052
0
paź 24
4582
1
kwi 17
4632