def?_init(self,items?=?{}):
????????????????"""Optionally?pass?in?an?inital?dictionary?of?items"""
????????????????if?type(items)?!=?type({}):
????????????????????????raise?TypeError("Fridge?requires?a?dictonary?but?was?given
????????????????????????????????????????%s?"?%type(items))
????????????????self.items?=?items
4 回答
已采納

大咪
TA貢獻785條經驗 獲得超332個贊
def?_init(self,?items={}): ????"""Optionally?pass?in?an?inital?dictionary?of?items""" ????if?type(items)?!=?type({}): ????????raise?TypeError("Fridge?requires?a?dictonary?but?was?given?\ ????????????????????????%?s?"?%type(items)) ????????self.items?=?items
添加回答
舉報
0/150
提交
取消