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和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
随机推荐
- 【读书笔记】Data_Mining_with_R---Chapter_2_Predicting Algae Blooms
本书概要 <Data Mining with R>这本书通过实例,并结合R讲解数据挖掘技术.本书的核心理念就是"Learning it by doing".本书分5章, ...
- 2. RabbitMQ 服务器 之下载安装
RabbitMQ服务器如何安装? RabbitMQ是一个AMQP(Advanced Message Queue,即高级消息队列协议)服务器 . 下载地址: RabbitMQ下载 安装说明:各平台下Ra ...
- supervisor详解
1.什么是supervisor supervisor是用python写的一个进程管理工具,用来启动,重启,关闭进程. 2.supervisor的安装 pip install supervisor 3. ...
- tensorflow 笔记8:RNN、Lstm源码,训练代码输入输出,维度分析
tensorflow 官网信息:https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/BasicLSTMCell tensorflow 版 ...
- pandas遍历行数据
假设我的DataFrame如图所示: 我可以这样遍历它: for index,row in list.iterrows(): id =row["id"] x=row["x ...
- 模仿CyclicBarrier,自定义自己屏障类
简介 在这里模仿CyclicBarrier,自定义一个自己多线程屏障类,里面有个计时器count,count为0时,才唤醒线程,否则就await挂起,(没错就是用的object类的挂起和唤醒全部线程方 ...
- SwingWorker
Swing应用程序员常见的错误是误用Swing事件调度线程(Event DispatchThread,EDT).他们要么从非UI线程访问UI组件:要么不考虑事件执行顺序:要么不使用独立任务线程而在ED ...
- Storm常见模式——流聚合
转自:http://www.cnblogs.com/panfeng412/archive/2012/06/04/storm-common-patterns-of-stream-join.html 流聚 ...
- java 全组合 与全排列
一.全组合 public static void Combination( ) { /*基本思路:求全组合,则假设原有元素n个,则最终组合结果是2^n个.原因是: * 用位操作方法:假设元素原本有:a ...
- Ubuntu下安装和使用zookeeper和kafka
1.在清华镜像站下载kafka_2.10-0.10.0.0.tgz 和 zookeeper-3.4.10.tar.gz 分别解压到/usr/local目录下 2.进入zookeeper目录,在conf ...