在学习class的时候,我遇到了以下问题:
class Restaurant:
def _init_(self,restaurant_name,cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
print(restaurant_name,cuisine_type)
def open_restaurant(self):
print('The restaurant named',self,"is opening")
a_new_restaurant = Restaurant("fashion",5)
a_new_restaurant.describe_restaurant()
结果出错:
```php
Traceback (most recent call last):
File "c:\Users\asus\Desktop\我的文件\class.py", line 10, in <module>
a_new_restaurant = Restaurant("fashion",5)
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Restaurant() takes no arguments
这是怎么回事?
请教各位求解!