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 在继承中出现的问题:未完的更多相关文章

  1. python中IndentationError: expected an indented block错误的解决方法

    IndentationError: expected an indented block 翻译为IndentationError:预期的缩进块 解决方法:有冒号的下一行要缩进,该缩进就缩进

  2. python 中出现 “IndentationError: expected an indented block” 问题

    python 学习 在定义Python函数的时候如下 >>>def hello() . . .print "hello" 这样会报错的,报错如下: Indenta ...

  3. [转]python问题:IndentationError:expected an indented block错误解决

    分类: python学习笔记2012-07-07 17:59 28433人阅读 评论(4) 收藏 举报 python语言 原文地址:http://hi.baidu.com/delinx/item/17 ...

  4. python问题:IndentationError:expected an indented block错误解决《转》

    python问题:IndentationError:expected an indented block错误解决 标签: python语言 2012-07-07 17:59 125145人阅读 评论( ...

  5. python问题:IndentationError:expected an indented block错误解决

    Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...

  6. IndentationError : expected an indented block

    IndentationError:在python的条件语句出现 expected an indented block问题 是指缩进问题,比如for循环里面的print前面需要四个空格. Python语 ...

  7. IndentationError:expected an indented block错误解决

    Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...

  8. Python问题1:IndentationError:expected an indented block

    Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...

  9. python问题:IndentationError:expected an indented block

    Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...

随机推荐

  1. FOR XML PATH 可以将查询结果根据行输出成XML格式

    SELECT CAST(OrderID AS varchar)+',' as OrderNo FROM Product CAST函数用于将某种数据类型的表达式显式转换为另一种数据类型 SELECT C ...

  2. 微信小程序跳转分析

    对于路由的触发方式以及页面生命周期函数如下: 路由方式 触发时机 路由前页面 路由后页面 初始化 小程序打开的第一个页面   onLoad, onShow 打开新页面 调用 API wx.naviga ...

  3. LeetCode: Valid Parentheses 解题报告

    Valid Parentheses Given a string containing just the characters '(', ')', '{', '}', '[' and ']', det ...

  4. oracle 函数to_char(数据,'FM999,999,999,999,990.00') 格式化数据(转)

    转载自:https://blog.csdn.net/fupengyao/article/details/52778565 遇到了oracle 取数格式问题,这里记一下 我们通常在做数据算数后,会想要让 ...

  5. Java知多少(86)文本框和文本区的输入输出

    在GUI中,常用文本框和文本区实现数据的输入和输出.如果采用文本区输入,通常另设一个数据输入完成按钮.当数据输入结束时,点击这个按钮.事件处理程序利用getText()方法从文本区中读取字符串信息.对 ...

  6. DWZ使用中遇到的坑

    DWZ官方文档中关于文件上传表单的提交: 因为Ajax不支持enctype="multipart/form-data" 所以用隐藏iframe来处理无刷新表单提交. <for ...

  7. Guava学习笔记(二):基础(Joiner,Objects,Splitter及Strings)

    添加Maven依赖 JoinerTest import com.google.common.base.Joiner; import org.junit.Assert; import org.junit ...

  8. Excel公式中使用动态计算的地址

    例:统计A列第四行开始,到公式所在行的前一行的非空白行的个数: =COUNTA(A4:INDIRECT(ADDRESS(ROW()-,COLUMN())))

  9. MySQL高性能优化系列

    https://www.cnblogs.com/huchong/p/10219318.html https://www.cnblogs.com/huchong/tag/MySQL%E9%AB%98%E ...

  10. [SLAM] ***AR Tracking based on which tools?

    SLAM虽然小复杂,但对于开发者而言,ar sdk通常会解决这个问题. 所以相对于识别,跟踪是个看上去高大上但实则不需要关注细节的部分. 识别,要技术深耕:跟踪,需行业深耕. 在此了解下常见的ar s ...