在此字典初始化过程中遇到语法错误,我不知道为什么。
elif user_choice == "H" or user_choice == "h":
if len(blockchain) >= 1:
blockchain[0] = {"previous_hash": "", "index": 0, "transactions": [{"sender": "Chris", "recipient": "Max", "amount", 100.0}]}
答案 0 :(得分:3)
在您的列表中,amount
带有逗号而不是分号:
[{"sender": "Chris", "recipient": "Max", "amount", 100.0}]
应该是:
[{"sender": "Chris", "recipient": "Max", "amount": 100.0}]