Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8492 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I fixed with code:

with open('z.jpg','wb+') as f:
f.write(base64.b64decode(self.file))
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 2 16
4119
0
thg 5 20
4571
0
thg 10 24
5186
1
thg 4 17
5186