当前位置:   article > 正文

初学Python 之 报错 “ TypeError: 'str' object is not callable ”_restaurant' object is not callable

restaurant' object is not callable

TypeError: 'str' object is not callable 


我的代码如下所示 

  1. class Restaurant():
  2. '''描述餐馆的基本属性'''
  3. def __init__(self,restaurant_name,cuisine_type):
  4. self.restaurant_name = restaurant_name
  5. self.cuisine_type = cuisine_type
  6. def describe_restaurant(self):
  7. '''描述餐馆'''
  8. print("This restaurant's type is " + self.cuisine_type + " . ")
  9. print("This restaurant's name is " + self.restaurant_name.title() + ".")
  10. def open_restautant(self):
  11. '''餐馆营业提醒'''
  12. print("Welcom our" + self.cuisine_type + " " + self.restaurant_name +" restaurant !" )
  13. restaurant_1 = Restaurant('Mandclo' ,'fast restaurant')
  14. restaurant_2 = Restaurant('水煮鱼','中餐厅')
  15. restaurant_3 = Restaurant('千岛酱','日本菜')
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/669685
推荐阅读
相关标签
  

闽ICP备14008679号