首页 > 解决方案 > 无效的语法 (,第 89 行)-pylint(语法错误)

问题描述

在此字典初始化时出现语法错误,我不知道为什么。

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}]}

标签: pythonblockchain

解决方案


在您的列表中,amount使用逗号而不是分号:

[{"sender": "Chris", "recipient": "Max", "amount", 100.0}]

应该:

[{"sender": "Chris", "recipient": "Max", "amount": 100.0}]


推荐阅读