实现目标:把文件1中数据如:B4A6C0ED69 处理后放入文件2:0XB4, 0XA6, 0XC0, 0XED, 0X69 V1.0代码如下(后续继续优化): #!/usr/bin/env python # -*- coding:utf-8 -*- from sys import argv script,first = argv buf = [] tmp = [] #读取待处理文件全部内容 并存到buf中 with open(first, 'r') as f: buf = f.read() f.closed #对buf中内容,进行每隔2个字符取出,并以", 0X"连接,最后在头部加上'