python - 无效的语法 (,第 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}]}
解决方案
在您的列表中,amount
使用逗号而不是分号:
[{"sender": "Chris", "recipient": "Max", "amount", 100.0}]
应该:
[{"sender": "Chris", "recipient": "Max", "amount": 100.0}]
推荐阅读
- crystal-reports - 水晶报表2011详情部分如何折叠或展开数据?
- angular - route.data.subscribe() 上的茉莉花测试
- c# - 托管在 azure 中的 SignalR Hub 未向少数连接发送消息 - AspNetCore.SignalR
- php - 仅当字符串不为空/空时如何解密字符串
- javascript - 这两个 Javascript 数组有什么区别?
- arrays - 使用 Vapor3 将多条记录插入数据库
- python - Popen 以其他用户身份运行的问题 (macOS)
- node.js - 在nodejs中缓存一个请求
- r - 是否可以使用“i”在循环中保存不同的变量?
- python - 使用 pre 和 post 方法调用装饰请求模块调用