我想获取作为结果显示的数据,例如312d 3036 2d30 3706 5814 0847 4831 3033 3733 3930就像我在十六进制编辑器中打开它一样,我试图通过编码/解码来实现,但是没有成功。
这是我编写的找到我想要的字符串的代码:
import re
import struct
file = open ("eeprom", "rb") .read().hex()
DTC_data = re.search("ffff30(.*)100077", file)
DTC_data_final = print (DTC_data.group(1))
#finds string between two strings in 2nd line of eeprom file
switch_data = re.search("010607(.*)313132", file)
switch_data_final = print (switch_data.group(1))
#finds string betwenn two strings in 3rd line of eeprom file
我得到的结果是
312d30362d3037065814
08474831303337333930