首页
学习
活动
专区
圈层
工具
发布

python 字节读写

Read the entire file as a single byte string

with open('somefile.bin', 'rb') as f: data = f.read()

Write binary data to a file

with open('somefile.bin', 'wb') as f: f.write(b'Hello World')

举报
领券