如何通过将元素1连接到元素2来将lst1转换为lst2,依此类推.
lst1=[' ff 55 00 90 00 92 00 ad 00 c6 00 b7 00 8d 00 98 00 87 00 8a 00 98 00 8f 00 ca 01 78 03 54 05 bf']
Run Code Online (Sandbox Code Playgroud)
至
lst2=[ff55, 0090, 0092, 00ad, 00c6, 00b7, 008d, 0098, 0087, 008a, 0098, 008f, 00ca, 0178, 0354,05bf]
Run Code Online (Sandbox Code Playgroud)
尝试过,但没有被解雇
for i in lst:
lstNew = []
tempList = i.split()
lenList = len(tempList)
#print tempList
index = 0
while (index < lenList):
print tempList[index] + tempList[index+1]
index = index …Run Code Online (Sandbox Code Playgroud) 我有一个HEX数据文件我想用python将它转换为SIGNED DECIMAL.
int('0xffd2',16)因为它将HEX转换为无符号DEC,所以不是解决方案.知道怎么做吗?
0xffd2, 65490
0xffcb, 65483
0xffcb, 65483
0xffcc, 65484
0x10, 16
0xc, 12
0xd, 13
0x0, 0
0xfffe, 65534
Run Code Online (Sandbox Code Playgroud) python ×2