Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
8417 Представления

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
5177
1
апр. 17
5164