python - AttributeError:“NoneType”对象在类对象列表中没有属性“n”
问题描述
哦,那是真的。现在该代码有效,但我的长代码仍然无效。这是https://pastebin.com/Z4qjGxCU。这个问题是,当我在瓷砖上调用 check_num() 时,它可以工作。但是当我调用 check_mouse()、load_image() [我已经评论过,因此您不必下载资产] 或 print_tile() 时,它们会返回如下错误:
Traceback (most recent call last):
File "C:\Users\sergio\Desktop\Minesweeper\minesweeper.py", line 96, in <module>
grid[i][j].check_mouse()
AttributeError: 'Tile' object has no attribute 'check_mouse'
我检查了代码,但我找不到任何错误的地方。有任何想法吗?
解决方案
class A:
用代替定义一个类def A()
推荐阅读
- logging - 在 GCP 中更改 Stackdriver Logging 日志的标头
- python - 在Django(Python)中多次传递参数失败
- node.js - 如何使用 vue js 作为前端和 postgres 作为后端创建节点 js 应用程序
- java - 替换 @Autowired Httpservlet 为什么在 springbok 中自动装配 httpservlet 不是一个好习惯?
- node.js - UTF-8 SQL 搜索
- linux - 根据列的值保留唯一 ID?
- f# - 如何在 F# 中为自定义类型定义一元减号?
- c# - 跳过等待任务响应条件
- hadoop - Hadoop mover 太慢了
- bash - 如何在mailx中插入名称字段