自: 的 25f207f2 8332c7da539dd2539230a7aad975f907a93d924b4b037abacde677f0f71f75cc250df2e4dd2be3e9的 7a60f289
要: 0x7a60f289 ,0xdd2be3e9,0x250df2e4,0xf71f75cc,0xcde677f0,0x4b037aba, 0xa93d924b,0xd975f907,0x9230a7aa,0x539dd253,0x8332c7da, 0x25f207f2
答案 0 :(得分:2)
只需将字符串切成块,然后反转使用str.format添加0x
的顺序:
s = "25f207f28332c7da539dd2539230a7aad975f907a93d924b4b037abacde677f0f71f75cc250df2e4dd2be3e97a60f289"
print(["0x{}".format(s[i-8:i]) for i in range(len(s), 0, -8) ])
['0x7a60f289', '0xdd2be3e9', '0x250df2e4', '0xf71f75cc', '0xcde677f0', '0x4b037aba', '0xa93d924b', '0xd975f907', '0x9230a7aa', '0x539dd253', '0x8332c7da', '0x25f207f2']
如果你真的想要小数:
print([int("0x{}".format(s[i-8:i]),16) for i in range(len(s), 0, -8) ])
[2053173897, 3710641129, 621671140, 4146034124, 3454433264, 1258519226, 2839384651, 3648387335, 2452662186, 1402851923, 2201143258, 636618738]