下面的代码是把文件111.bin
分割成了三个文件
file_ziku
file_uni2gb
file_asc
import sys
num = 0
fnum = 0
source_dir = "C:/Users/Administrator/Desktop/lesson1/file/111.bin"
file_ziku = 'C:/Users/Administrator/Desktop/lesson1/file/file1212_196278.bin'
file_uni2gb = 'C:/Users/Administrator/Desktop/lesson1/file/file_uni2gbk.bin'
file_asc='C:/Users/Administrator/Desktop/lesson1/file/file_asc.bin'
'''
0
196278
238082
239624
'''
fd = open(source_dir,'rb')
cont = fd.read(196278-0)
fw1 = open(file_ziku,'wb')
fw1.write(cont)
fw1.close()
cont = fd.read(238082-196278)
fw2 = open(file_uni2gb,'wb')
fw2.write(cont)
fw2.close()
cont = fd.read(239624-238082)
fw2 = open(file_asc,'wb')
fw2.write(cont)
fw2.close()
fd.close()