我有一個包含以下內容的文本文件:如何從此文件提取數據?
Block 15, type A, key 05a3e664414a :00 00 00 00 00 00 ff 07 80 69 94 82 c8 cc 46 0a
Block 14, type A, key 05a3e664414a :14 14 14 18 10 18 13 13 10 13 18 19 11 10 11 15
Block 13, type A, key 05a3e664414a :15 14 14 14 18 10 18 13 13 10 13 18 19 11 10 11
Block 12, type A, key 05a3e664414a :07 05 04 04 04 08 00 08 03 03 10 13 18 19 11 10
Block 11, type A, key 05a398f21b26 :00 00 00 00 00 00 ff 07 80 69 4c 36 e4 30 46 0a
Block 10, type A, key 05a398f21b26 :08 00 07 05 04 07 04 08 00 08 13 13 10 13 18 18
Block 09, type A, key 05a398f21b26 :05 08 00 07 05 06 04 04 08 00 18 13 13 10 13 18
Block 08, type A, key 05a398f21b26 :11 15 18 10 17 15 14 14 14 18 10 18 13 13 10 13
Block 07, type A, key 0577a23d1e96 :00 00 00 00 00 00 ff 07 80 69 2c 3c 7a 44 ee 0a
Block 06, type A, key 0577a23d1e96 :03 10 11 15 18 10 17 15 14 14 14 18 10 18 13 07
Block 05, type A, key 0577a23d1e96 :09 07 10 11 15 18 10 17 15 14 14 14 18 10 18 13
Block 04, type A, key 0577a23d1e96 :18 19 11 10 11 15 18 10 17 15 14 14 14 18 10 18
Block 03, type A, key a64ca2e58cc1 :00 00 00 00 00 00 ff 07 80 69 a6 4c a2 e5 8c c1
Block 02, type A, key a64ca2e58cc1 :00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 01, type A, key a64ca2e58cc1 :70 60 62 67 7a 50 42 55 65 59 42 5c 15 14 14 14
Block 00, type A, key a64ca2e58cc1 :c4 ed 60 47 0e 08 04 00 62 63 64 65 66 67 68 69
我想寫一個python程序提取鍵和返回它們如下:
[[0xa6, 0x4c, 0xa2, 0xe5, 0x8c, 0xc1],
[0x05, 0x77, 0xa2, 0x3d, 0x1e, 0x96],
[0x05, 0xa3, 0x98, 0xf2, 0x1b, 0x26],
[0x05, 0xa3, 0xe6, 0x64, 0x41, 0x4a],]
這與平等:
[[hex form of block 00 key],
[hex form of block 04 key],
[hex form of block 08 key],
[hex form of block 12 key]]
我該怎麼做?我的意思是我該如何檢測使用正則表達式?
凡'0x'從何而來? –
多數民衆贊成在十六進制數...我更加好奇,其中a6和4c等來自... –
@AvinashRaj我補充說,我自己 – Abraham