我正在尝试制作一个基于文本的曲棍球团队管理游戏,但是每当我引用我的函数时,我就会得到“预期的缩进块”。不知道我是不是很笨,找不到我的错什么的。你知道吗
def startup():
print "Welcome to the Text Based Hockey League!"
print "You will be tasked with being a team's General Manager"
yourTeam = raw_input()
class tbhl:
def __init__(self):
self.teamList["Mustangs", "Wolves", "Indians", "Tigers", "Bears", "Eagles", yourTeam]
class game:
def __init__(self, homeScore, awayScore):
#games left in a team class
startup() #<-The line that the error points to
tbhl = tbhl()
print tbhl.teamList[7]
当有注释掉的块作为函数的唯一代码时,还可以使用关键字
pass
来防止此错误。任何开始新一行缩进的代码块都不能留空(或只带注释)pass
是一个no-op,当编译器在该缩进级别上查找某些内容时,它会使编译器满意。你知道吗相关问题 更多 >
编程相关推荐