python中wb什么意思,使用Python,“ wb”在此代码中是什么意思?
Code:
file('pinax/media/a.jpg', 'wb')
解決方案
File mode, write and binary. Since you are writing a .jpg file, it looks fine.
But if you supposed to read that jpg file you need to use 'rb'
More info
On Windows, 'b' appended to the mode
opens the file in binary mode, so
there are also modes like 'rb', 'wb',
and 'r+b'. Python on Windows makes a
distinction between text and binary
files; the end-of-line characters in
text files are automatically altered
slightly when data is read or written.
This behind-the-scenes modification to
file data is fine for ASCII text
files, but it’ll corrupt binary data
like that in JPEG or EXE files.
總結
以上是生活随笔為你收集整理的python中wb什么意思,使用Python,“ wb”在此代码中是什么意思?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: symbian塞班系统支持格式
- 下一篇: VirtualBox 虚拟机内操作系统与