Python Dict数据的格式化显示
Posted sanqima
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python Dict数据的格式化显示相关的知识,希望对你有一定的参考价值。
Python里的Dict(字典)是一个非常规则的数据,这里介绍将Dict格式化。
比如,将一行很长的Dict数据进行格式化,进入专门的python格式化网站: https://www.xhcode.com/pythonformat/,输入字符串后,再点击[Python code formatting]按钮 --> OK。
原文
[AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 16, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000bce5fe052b25e422550f6012fdd1941f9353f001'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0xa9b04ff42f93868886c1258ba59967ceb6aafa0118655032210a867bdad7cff1'), 'transactionIndex': 24), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 39, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x0000000000000000000000001f52775214e2b3d099eb82b6e9e9025c490157ad'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0xc96ee63d87a2d21b1dccff4d3de50726887cadbf010cc749efff355383dc1a7b'), 'transactionIndex': 25), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 41, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x0000000000000000000000002858e866c5fdcefea13bedf13948a785b5c8b040'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x46a9ce0dbc787533c6bda878ff3c4f2354b86301bf4f6beeb237e7baf307d4a3'), 'transactionIndex': 26), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 43, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000903171964ee615dc99f350bd29ea747b887ae3f4'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x9dab17b59a0612347929fe03bb82d6a03f8a0880ac6201eb992c4f3b4fb4d088'), 'transactionIndex': 27), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 47, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000798be9b2adfca455c78fb648ec11538c0964f69d'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0xff7bf9419390ebea5eb3786c4f05c18c4ba879cde8e8e5bcd8380b6c6e332722'), 'transactionIndex': 28), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 49, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000445328c3b205ea0415a9e8fb6ea8e4c5d2db6b2e'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x886d559cedfc71914a132d89f191a3e9969fd84dc532782f39e12f465d69c570'), 'transactionIndex': 29), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 53, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000657fbeee7214758a72e3139ec0d04b162e274814'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x52f56633312ff33cedb7dea149df5206e6c257f46ae53a6be250a341beeaad4a'), 'transactionIndex': 30), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 55, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000425a488128af3ed04886aa4220b58c145601f23f'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x5fa6178295aa01b01076d2ad5a329b6477d64e2fa63ee6cf4d991181ec3d8353'), 'transactionIndex': 31), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 57, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000ae3703814fd2658ea0ae7da11fed10047ae89c49'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x670a34663303a0b7026af3e19e5aca88c4f4efb81f31694daf5a1c59dd177920'), 'transactionIndex': 32), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 61, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000685db7892a33cd919774eea104f1b3cfd25f470e'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x3b801a44c76dfba29198c1c3f7eb4edef0203a229cbb8356b167e185570d21a5'), 'transactionIndex': 33), AttributeDict('address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 63, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x000000000000000000000000d4d64d331281e5cfed11fcfb23882a3ee946289f'), HexBytes('0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508')], 'transactionHash': HexBytes('0x4ac6c353cdef32232a28fd3608d3223c329f28c5e8161ff411bf624f4f234b59'), 'transactionIndex': 34), AttributeDict('address': '0x6B175474E89094C44Da98b954EedeAC495271d0F', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 117, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x00000000000000000000000009e80bde912794fdbea1e5b68b0c37a346b73cfc'), HexBytes('0x000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c')], 'transactionHash': HexBytes('0x0355b2fd83d185dcd66747912a263d4fcdbcbe49ca0339356b2ee6f37dd32d56'), 'transactionIndex': 79), AttributeDict('address': '0x6B175474E89094C44Da98b954EedeAC495271d0F', 'blockHash': HexBytes('0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'), 'blockNumber': 10000000, 'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'logIndex': 118, 'removed': False, 'topics': [HexBytes('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'), HexBytes('0x00000000000000000000000009e80bde912794fdbea1e5b68b0c37a346b73cfc'), HexBytes('0x000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c')], 'transactionHash': HexBytes('0x0970f816796847911dad06200b6f7d71175187f9d47c804d5efefd9846ce0cfd'), 'transactionIndex': 80)]
格式化
效果如下:
格式化的文件,使用.r后缀保存,比如,res.r。
// res.r
[AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 16,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000bce5fe052b25e422550f6012fdd1941f9353f001'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0xa9b04ff42f93868886c1258ba59967ceb6aafa0118655032210a867bdad7cff1'
),
'transactionIndex': 24
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 39,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x0000000000000000000000001f52775214e2b3d099eb82b6e9e9025c490157ad'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0xc96ee63d87a2d21b1dccff4d3de50726887cadbf010cc749efff355383dc1a7b'
),
'transactionIndex': 25
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 41,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x0000000000000000000000002858e866c5fdcefea13bedf13948a785b5c8b040'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x46a9ce0dbc787533c6bda878ff3c4f2354b86301bf4f6beeb237e7baf307d4a3'
),
'transactionIndex': 26
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 43,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000903171964ee615dc99f350bd29ea747b887ae3f4'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x9dab17b59a0612347929fe03bb82d6a03f8a0880ac6201eb992c4f3b4fb4d088'
),
'transactionIndex': 27
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 47,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000798be9b2adfca455c78fb648ec11538c0964f69d'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0xff7bf9419390ebea5eb3786c4f05c18c4ba879cde8e8e5bcd8380b6c6e332722'
),
'transactionIndex': 28
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 49,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000445328c3b205ea0415a9e8fb6ea8e4c5d2db6b2e'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x886d559cedfc71914a132d89f191a3e9969fd84dc532782f39e12f465d69c570'
),
'transactionIndex': 29
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 53,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000657fbeee7214758a72e3139ec0d04b162e274814'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x52f56633312ff33cedb7dea149df5206e6c257f46ae53a6be250a341beeaad4a'
),
'transactionIndex': 30
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 55,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000425a488128af3ed04886aa4220b58c145601f23f'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x5fa6178295aa01b01076d2ad5a329b6477d64e2fa63ee6cf4d991181ec3d8353'
),
'transactionIndex': 31
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 57,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000ae3703814fd2658ea0ae7da11fed10047ae89c49'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x670a34663303a0b7026af3e19e5aca88c4f4efb81f31694daf5a1c59dd177920'
),
'transactionIndex': 32
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 61,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000685db7892a33cd919774eea104f1b3cfd25f470e'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x3b801a44c76dfba29198c1c3f7eb4edef0203a229cbb8356b167e185570d21a5'
),
'transactionIndex': 33
), AttributeDict(
'address': '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 63,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x000000000000000000000000d4d64d331281e5cfed11fcfb23882a3ee946289f'
), HexBytes(
'0x0000000000000000000000008a91c9a16cd62693649d80afa85a09dbbdcb8508'
)],
'transactionHash': HexBytes(
'0x4ac6c353cdef32232a28fd3608d3223c329f28c5e8161ff411bf624f4f234b59'
),
'transactionIndex': 34
), AttributeDict(
'address': '0x6B175474E89094C44Da98b954EedeAC495271d0F',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 117,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x00000000000000000000000009e80bde912794fdbea1e5b68b0c37a346b73cfc'
), HexBytes(
'0x000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c'
)],
'transactionHash': HexBytes(
'0x0355b2fd83d185dcd66747912a263d4fcdbcbe49ca0339356b2ee6f37dd32d56'
),
'transactionIndex': 79
), AttributeDict(
'address': '0x6B175474E89094C44Da98b954EedeAC495271d0F',
'blockHash': HexBytes(
'0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe'
),
'blockNumber': 10000000,
'data': '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
'logIndex': 118,
'removed': False,
'topics': [HexBytes(
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
), HexBytes(
'0x00000000000000000000000009e80bde912794fdbea1e5b68b0c37a346b73cfc'
), HexBytes(
'0x000000000000000000000000882d80d3a191859d64477eb78cca46599307ec1c'
)],
'transactionHash': HexBytes(
'0x0970f816796847911dad06200b6f7d71175187f9d47c804d5efefd9846ce0cfd'
),
'transactionIndex': 80
)]
以上是关于Python Dict数据的格式化显示的主要内容,如果未能解决你的问题,请参考以下文章