Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
8421 มุมมอง

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
4077
0
พ.ค. 20
4567
0
ต.ค. 24
5177
1
เม.ย. 17
5164