تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
8485 أدوات العرض

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
فبراير 16
4115
0
مايو 20
4569
0
أكتوبر 24
5186
1
أبريل 17
5176