콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
8395 화면

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))
아바타
취소
관련 게시물 답글 화면 활동
0
2월 16
4072
0
5월 20
4563
0
10월 24
5174
1
4월 17
5158