class Restaurant():
def _init_(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
print(self.restaurant)
print(self.cuisine_type)
def open_restaurant(self):
print("餐馆正在营业")
restaurant = Restaurant("haoyunlai", "hot pot")
restaurant.describe_restaurant()
restaurant.open_restaurant()
init_前后都是两个下划线__init_
多让编译器自动生成函数名,少手敲
init 这个是双下划线么?