无效语法(<unknown>,第89行)pylint(syntaxerror)

2024-04-28 04:23:14 发布

您现在位置:Python中文网/ 问答频道 /正文

在这个字典初始化时得到一个语法错误,我不知道为什么。在

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

Tags: orindexlenif字典hashsenderchris
1条回答
网友
1楼 · 发布于 2024-04-28 04:23:14

在您的列表中,amount包含逗号而不是分号:

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

应该是:

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

相关问题 更多 >