python脚本0b文件处理

要处理的文件:

此处处理将00的数据干掉。

处理python脚本:

 1 dir_fd = open('abc.yuv','rb+')
 2 tmp_fd = open('tmp.yuv','wb+')
 3 while True:
 4     content = dir_fd.read(1)
 5     
 6    # content.int('10',16)
 7     if content==b'\x00':
 8         continue
 9     if content==b'':
10         tmp_fd.write("/n")
11         break
12     print(content)
13     tmp_fd.write(content)
14     tmp_fd.flush()
 1 dir_fd = open('abc.yuv','rb+')
 2 tmp_fd = open('tmp.yuv','wb+')
 3 while True:
 4     content = dir_fd.read(1)
 5     
 6    # content.int('10',16)
 7     if content==b'\x00':
 8         continue
 9     if content==b'':
10         tmp_fd.write("/n")
11         break
12     print(content)
13     tmp_fd.write(content)
14     tmp_fd.flush()

处理之后的效果:

 

posted @ 2016-10-16 00:04  高傲的monkey  阅读(421)  评论(0编辑  收藏  举报