Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
8414 Переглядів

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?

Аватар
Відмінити
Автор Найкраща відповідь

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
лют. 16
4076
0
трав. 20
4567
0
жовт. 24
5176
1
квіт. 17
5162