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和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
随机推荐
- memcached配置 启动
memcached:http://memcached.org/ libevent:http://libevent.org/ #下载包 cd /opt wget https://github.com/d ...
- 【驱动】Linux初级驱动系列框架
[系统环境搭建] 1.uboot的命令 set serverip .xx set ipaddr .xxx set bootcmd tftp zImage\;bootm //开发模式 set bootc ...
- VIM空格和TAB转换
在.vimrc中添加以下代码后,重启vim即可实现按TAB产生4个空格:set ts=4 (注:ts是tabstop的缩写,设TAB宽4个空格)set expandtab 对于已保存的文件,可以使用下 ...
- WARNING: Can not get binary dependencies for file...
环境: window7 64bit python 3.5 pyinstaller 3.2 用pyinstaller 将python文件打包成exe文件的过程中,出现了如下的错误 C:\Users\ca ...
- 教你一招:使用最快速的方式激活windows10专业版
1.安装win10专业版 2.在桌面新建“文本文档.txt” 3.复制如下代码到新新建的“文本文档.txt”中 slmgr /ipk VK7JG-NPHTM-C97JM-9MPGT-3V66T slm ...
- Git 修正错误
大部分的人都会犯错.所以每VCS提供了一个功能,修正错误,直到特定的点. Git提供功能使用,我们可以撤销已作出的修改到本地资源库. 假设用户不小心做了一些更改,以他的本地的仓库,现在他要扔掉这些变化 ...
- Eclipse的Project Facets属性
Project Facets 1. 'Project Facets'可理解为:项目的特性,主流 IDE (Eclipse IDEA) 都提供了 facet 的配置. 'Project Facets' ...
- 【转载】Eclipse 的快捷键以及文档注释、多行注释的快捷键
一.多行注释快捷键 1.选中你要加注释的区域,用ctrl+shift+C 或者ctrl+/ 会加上//注释2.先把你要注释的东西选中,用shit+ctrl+/ 会加上/* */注释 3.以上快捷 ...
- iPhone 上你可能还不知道的小技巧
用了这么久的 iPhone,这些技巧你可能都还不知道哦. 1.怎么用耳机切歌? 将耳机的话筒部位的中间(平时暂停用的,按一下)连按两下 即可. 连按两下,下一首. 连按三下,上一首. 2.摇一摇,相当 ...
- Elasticsearch 学习之不停止服务,完成升级重启维护操作
我们可以设置集群的平衡参数来暂时禁用掉平衡,具体步骤如下: 1.如果可能的话,先暂停掉数据新增和更新操作,这样会提高集群恢复的时间: 2.禁用集群分片平衡操作,直到告诉集群可以恢复平衡操作为止,禁用配 ...