【发布时间】:2017-03-12 10:52:22
【问题描述】:
这是我的代码:
import pygame
class Ship():
def __init__(self):
self.image = pygame.image.load('images/ship.bmp')
my_ship = Ship
print(my_ship.image)
AttributeError: type object 'Ship' has no attribute 'image'
我使用 pycharm6 和 python3.6。我是python的初学者,希望有人能帮助我。
【问题讨论】:
-
我们需要minimal, complete and verifiable example。并发布完整的回溯(错误消息)。
-
对不起,我重新修改了格式。
-
你应该多学习Python,然后你就会明白你需要实例化Ship的实例。
标签: python python-3.x pygame