{"id":2239,"date":"2023-11-10T18:01:49","date_gmt":"2023-11-10T10:01:49","guid":{"rendered":"https:\/\/bianchenghao6.com\/2239.html"},"modified":"2023-11-10T18:02:11","modified_gmt":"2023-11-10T10:02:11","slug":"%e5%88%9b%e5%bb%ba%e5%8c%ba%e5%9d%97%e9%93%be","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/2239.html","title":{"rendered":"\u521b\u5efa\u533a\u5757\u94fe"},"content":{"rendered":"
\n
Python\u533a\u5757\u94fe\u521b\u5efa\u533a\u5757\u94fe\u8be6\u7ec6\u64cd\u4f5c\u6559\u7a0b<\/span>\n <\/div>\n <\/body> # Filename : example.py<\/span>
# Copyright : 2020 By Bianchenghao6<\/span>
# Author by : bianchenghao6.com<\/span>
# Date : 2020-08-28<\/span>
TPCoins = []
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n dump_blockchain <\/b>\u7684\u5b9e\u7528\u7a0b\u5e8f\u65b9\u6cd5\uff0c\u7528\u4e8e\u8f6c\u50a8\u6574\u4e2a\u533a\u5757\u94fe\u7684\u5185\u5bb9\u3002\u6211\u4eec\u9996\u5148\u6253\u5370\u533a\u5757\u94fe\u7684\u957f\u5ea6\uff0c\u4ee5\u4fbf\u77e5\u9053\u533a\u5757\u94fe\u4e2d\u5f53\u524d\u5b58\u5728\u591a\u5c11\u4e2a\u533a\u5757\u3002\n <\/div>\n # Filename : example.py<\/span>
# Copyright : 2020 By Bianchenghao6<\/span>
# Author by : bianchenghao6.com<\/span>
# Date : 2020-08-28<\/span>
def <\/span>dump_blockchain <\/span>(self):
print <\/span>(\"Number of blocks in <\/span>the chain: \"<\/span> + str(len (self)))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n for <\/b>\u5faa\u73af-\n <\/div>\n # Filename : example.py<\/span>
# Copyright : 2020 By Bianchenghao6<\/span>
# Author by : bianchenghao6.com<\/span>
# Date : 2020-08-28<\/span>
for <\/span><\/span>x in <\/span>range (len(TPCoins)):
block_temp = TPCoins[x]
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n block_temp <\/b>\u7684\u4e34\u65f6\u53d8\u91cf\u4e2d\u3002\n <\/div>\n # Filename : example.py<\/span>
# Copyright : 2020 By Bianchenghao6<\/span>
# Author by : bianchenghao6.com<\/span>
# Date : 2020-08-28<\/span>
print <\/span>(\"block # \"<\/span> + str(x))
<\/span> <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n verified_transactions <\/b>\u7684\u53d8\u91cf\u4e2d\u3002\u6211\u4eec\u5728
\n for <\/b>\u5faa\u73af\u4e2d\u8fed\u4ee3\u6b64\u5217\u8868\uff0c\u5bf9\u4e8e\u6bcf\u4e2a\u68c0\u7d22\u5230\u7684\u9879\u76ee\uff0c\u6211\u4eec\u8c03\u7528
\n display_transaction <\/b>\u51fd\u6570\u4ee5\u663e\u793a\u4ea4\u6613\u660e\u7ec6\u3002\n <\/div>\n # Filename : example.py<\/span>
# Copyright : 2020 By Bianchenghao6<\/span>
# Author by : bianchenghao6.com<\/span>
# Date : 2020-08-28<\/span>
for <\/span><\/span>transaction in <\/span>block_temp.verified_transactions:
display_transaction (transaction)
<\/span><\/code><\/pre>\n<\/p><\/div>\n # Filename : example.py<\/span>
# Copyright : 2020 By Bianchenghao6<\/span>
# Author by : bianchenghao6.com<\/span>
# Date : 2020-08-28<\/span>
def <\/span>dump_blockchain <\/span>(self):
print <\/span>(\"Number of blocks in <\/span>the chain: \"<\/span> + str(len (self)))
for <\/span><\/span>x in <\/span>range (len(TPCoins)):
block_temp = TPCoins[x]
print <\/span>(\"block # \"<\/span> + str(x))
<\/span> for <\/span><\/span>transaction in <\/span>block_temp.verified_transactions:
display_transaction (transaction)
print <\/span>('--------------'<\/span>)
print <\/span>('====================================='<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"zh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[169],"tags":[],"class_list":["post-2239","post","type-post","status-publish","format-standard","hentry","category-python_qkl"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/2239"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=2239"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/2239\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=2239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=2239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=2239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}