|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
可能是个老问题。但自己修改了,怎么都不对。<零基础入门学python>中110面的代码例子:
import random as r
class Fish:
def __init__(self):
self.x = r.randint(0,10)
self.y = r.randint(0,10)
def move(self):
self.x = -1
print("我的位置是:",self.x , self.y)
class Goldfish(Fish):
pass
class Carp(Fish):
pass
class Salmon(Fish):
pass
class Shark(Fish):
def __init__(self):
self.hugry = True
def eat(self): //这行提示:unindent does not match any outer indentation leve.
if self.hungry = False
print("吃货的梦想:")
self.hungry = False
else:
print("太撑了!")
错误截图如下:
C:\Users\Administrator\Desktop\1.png
我在网上也查了,说是没有对齐。我重新都用tab对齐,但是还是这行有错。要问下,怎么检查修改?在python中对齐有这么麻烦么?win7系统,python3.52
import random as r
class Fish:
def __init__(self):
self.x = r.randint(0,10)
self.y = r.randint(0,10)
def move(self):
self.x = -1
print("我的位置是:",self.x , self.y)
class Goldfish(Fish):
pass
class Carp(Fish):
pass
class Salmon(Fish):
pass
class Shark(Fish):
def __init__(self):
self.hugry = True
def eat(self): #这行提示:unindent does not match any outer indentation leve.
if self.hungry == False:
print("吃货的梦想:")
self.hungry = False
else:
print("太撑了!")
自己对照下
|
|