包头48bit 数据98464 。。。如此循环:

piece_size = 48
piece_size1 = 98464 with open("C:\\Users\\Administrator\\Desktop\\bins\\234.bin", "rb") as in_file, open("C:\\Users\\Administrator\\Desktop\\bins\\234_deal.bin", "ab+") as out_file:
while True:
piece = in_file.read(piece_size)
piece1= in_file.read(piece_size1)
if not piece:
break
if not piece1:
break
out_file.write(piece1)
in_file.close()
out_file.close() # f = open("C:\\Users\\Administrator\\Desktop\\bins\\OUT4.TXT", 'rb')
# while True:
# block = f.read(1024)
# print(block)
# if not block:
# break
# f.close()

python 工具 二进制文件处理之——去掉指定长度数据包头的更多相关文章

  1. python工具 - 读取文件的部分指定内容并输出到外置窗口

    一.使用场景 某些配置文件里有一些特定的字符,而这些字符恰巧需要我们采集出来,然后输出到另外一个窗口做展示时,可以使用该工具. 本例的演示则提取配置文件中的[姓名:黄蓉 女 九阴真经.姓名:郭靖 男 ...

  2. python 工具 二进制文件处理之——大小端变换

    大端换小端 16位: import struct import sys # main body if sys.argv.__len__() > 1: # 参数获取 src_file = sys. ...

  3. List集合工具类之"将list集合按"指定长度"进行切分Lists.partition和ListUtils.partition"

    将list集合按"指定长度"进行切分,返回新的List<List<类型>>集合,如下的:  方法1:List<List<Integer>& ...

  4. python工具 - 批量文件重命名

    日常工作中经常会遇到这样的情况,需要将某个文件夹下的文件按着一定的规则进行重命名,当文件数量及其庞大的时候手工一个一个的去修需要耗费大量的时间,以下python工具可以协助批量修改文件名. 场景:某文 ...

  5. 数据分析常用的python工具和SQL语句

    select symbol, "price.*" from stocks :使用正则表达式来指定列查询 select count(*), avg(salary) from empl ...

  6. 初学Python写二进制文件

    初学Python写二进制文件 把一个图片的16进制数据保存到一个txt文本,从这个txt文本读出并保存为二进制文件jpg图片文件.说明:图片读出的0xff粘贴ff到文本中,读出时是字符串的”ff”. ...

  7. C#利用substring按指定长度分割字符串

    这几天学习分析声音的波形数据,接收到的是十六进制的数据,需要将数据转换成十进制再绘图,这个过程涉及到字符串的分割,正好可以促进自己对C#相关知识的学习.说到分割字符串,我首先想到的是Split,但根据 ...

  8. 借助python工具从word文件中抽取相关表的定义,最后组装建表语句-非常好

    借助python工具从word文件中抽取表的定义,最后组装建表语句-非常好 --如有转载请以超链接的方式注明原文章出处,谢谢大家.请尊重每一位乐于分享的原创者 1.python脚本 ## -*- co ...

  9. Oracle 截取指定长度的字符

    去掉回车,换行符号,截取指定长度的字符 具体代码示例: --Function --去掉前后空格,截取字符,字符长度为P_Length create or replace function get_St ...

随机推荐

  1. webdriver高级应用- 操作日期控件

    1. 通过点击的方式操作日期控件 #encoding=utf-8 from selenium import webdriver import unittest, time, traceback fro ...

  2. python基础补漏-09-反射

    isinstance class A: passclass B(A): pass b = B()print isinatance(b,A)issubclass 判断某一个类是不是另外一个类的派生类 # ...

  3. tornado中文教程

    http://docs.pythontab.com/tornado/introduction-to-tornado/ch2.html#ch2-1 python的各种库的中文教程 http://docs ...

  4. TOJ 4493 Remove Digits 贪心

    4493: Remove Digits Description Given an N-digit number, you should remove K digits and make the new ...

  5. HTTP重定向

    404 Not Found301 Moved Permanently302 Found500 Internal Server ErrorHTTP重定向就是通过301和302两种状态码来实现的. 302 ...

  6. poj1006 中国剩余定理&&中国剩余定理解析

    poj 1006 题的思路不是很难的,可以转化数学式: 现设 num 是下一个相同日子距离开始的天数 p,e,i,d 如题中所设! 那么就可以得到三个式子:( num + d ) % 23 == p: ...

  7. Java容器jdk1.6 Array

    参考:https://www.cnblogs.com/tstd/p/5042087.html 1.定义 顶层接口collection public interface Collection<E& ...

  8. 自定义AlertView(Swift)

    MyAlertView.swift // Pop Up Styles enum MyAlertViewStyle: Int { case success case error case notice ...

  9. debian 切换最新源

    deb http://ftp.cn.debian.org/debian sid main#deb http://ftp.debian.org/debian/ wheezy main

  10. ACM程序设计选修课——1018: Common Subsequence(DP)

    问题 L: Common Subsequence 时间限制: 1 Sec  内存限制: 32 MB 提交: 70  解决: 40 [提交][状态][讨论版] 题目描述 A subsequence of ...