is there a way in python to write less than 1 byte data
even when I write the number 0 which represented in 1 bit the file size is 1(8 bits) byte
I tried the struct module
file.write(struct.pack('b',0))
array module
import array
data1=array.array('B')
x=bin(0)[2:]
data1.append(int(0,2))
f2=open('/root/x.txt','wb')
data1.tofile(f2)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…