IndentationError: expected an indented block 在继承中出现的问题:未完
1.
class Foo(object):
def __init__(self,name,price,period):
self.name=name
self.price=price
self.period=period
def __repr__(self):
return 'Foo:%s--%s--%s'%(self.name,self.price,self.price)
# def __str__(self):
# return 'Foo:%s--%s'%(self.name,self.price)
class Son(Foo):
# def func(self):
# pass
# def __repr__(self):
# return 'Son:%s--%s--%s'%(self.name,self.price,self.price)
# def __str__(self):
# return 'Son:%s--%s'%(self.name,self.price)
alex = Son('lemon',13.5,'一季度')
print(alex)
#这时运行时会飘红出错!!

而我在派生类中建立了函数,结果就运行出来了。
class Foo(object):
def __init__(self,name,price,period):
self.name=name
self.price=price
self.period=period
def __repr__(self):
return 'Foo:%s--%s--%s'%(self.name,self.price,self.price)
# def __str__(self):
# return 'Foo:%s--%s'%(self.name,self.price)
class Son(Foo):
def func(self):
pass
# def __repr__(self):
# return 'Son:%s--%s--%s'%(self.name,self.price,self.price)
# def __str__(self):
# return 'Son:%s--%s'%(self.name,self.price)
alex = Son('lemon',13.5,'一季度')
print(alex)
IndentationError: expected an indented block 在继承中出现的问题:未完的更多相关文章
- python中IndentationError: expected an indented block错误的解决方法
IndentationError: expected an indented block 翻译为IndentationError:预期的缩进块 解决方法:有冒号的下一行要缩进,该缩进就缩进
- python 中出现 “IndentationError: expected an indented block” 问题
python 学习 在定义Python函数的时候如下 >>>def hello() . . .print "hello" 这样会报错的,报错如下: Indenta ...
- [转]python问题:IndentationError:expected an indented block错误解决
分类: python学习笔记2012-07-07 17:59 28433人阅读 评论(4) 收藏 举报 python语言 原文地址:http://hi.baidu.com/delinx/item/17 ...
- python问题:IndentationError:expected an indented block错误解决《转》
python问题:IndentationError:expected an indented block错误解决 标签: python语言 2012-07-07 17:59 125145人阅读 评论( ...
- python问题:IndentationError:expected an indented block错误解决
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- IndentationError : expected an indented block
IndentationError:在python的条件语句出现 expected an indented block问题 是指缩进问题,比如for循环里面的print前面需要四个空格. Python语 ...
- IndentationError:expected an indented block错误解决
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- Python问题1:IndentationError:expected an indented block
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- python问题:IndentationError:expected an indented block
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
随机推荐
- 在Java API设计中,面向接口编程的思想,以及接口和工厂的关系
现在的java API的设计中,提倡面向接口的编程,即在API的设计中,参数的传递和返回建议使用接口,而不是具体的实现类,如一个方法的输入参数类型应该使用Map接口,而不是HashMap或Hashta ...
- mySql存储emoji表情报错(mysql incorrect string value)
问题分析 普通的字符串或者表情都是占位3个字节,所以utf8足够用了,但是移动端的表情符号占位是4个字节,普通的utf8就不够用了,为了应对无线互联网的机遇和挑战.避免 emoji 表情符号带来的问题 ...
- [JS] ECMAScript 6 - Class : compare with c#
Ref: Class 的基本语法 Ref: Class 的基本继承 许多面向对象的语言都有修饰器(Decorator)函数,用来修改类的行为.目前,有一个提案将这项功能,引入了 ECMAScript. ...
- 4、一、Introduction(入门):3、System Permissions(系统权限)
3.System Permissions(系统权限) Android is a privilege-separated operating system, in which each applic ...
- BackgroundWorker学习笔记
1 简介 BackgroundWorker 类允许您在单独的专用线程上运行操作. 耗时的操作(如下载和数据库事务)在长时间运行时可能会导致用户界面 (UI) 似乎处于停止响应状态. 如果您需要能进行响 ...
- Redmine发布新闻,自动发送邮件功能失效恢复
问题描述:操作数据库,修改项目公开状体后,创建新闻,自动发送邮件功能失效. 问题检查和恢复测试: 1.检查管理员权限 2.重新手动配置项目公开状态,覆盖数据操作 3.对比其他正常项目数据库状态,进行恢 ...
- ORM正向和反向查询
表结构 from django.db import models # Create your models here.class Publisher(models.Model): id = model ...
- Project Move from Qt 4 to Qt 5 项目工程的迁移
将Qt4的项目迁到Qt5中并不需要新建一个Qt5的工程,可以直接在原工程文件上修改,这里我们使用的是VS2010和Qt5.4的环境,我们需要做以下修改: 1. 在工程里找到这个文件:工程名.vcxpr ...
- Docker 修改国内镜像地址
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://86d2a50b.m.daocloud.io 该脚本可以 ...
- [Asp.net]缓存简介
写在前面 针对一些经常访问而很少改变的数据,使用缓存,可以提高性能.缓存是一种用空间换取时间的技术,说的直白点就是,第一次访问从数据库中读取数据,然后将这些数据存在一个地方,比如内存,硬盘中,再次访问 ...