【发布时间】:2013-11-26 05:05:27
【问题描述】:
class Photo:
'Fields: size, pdate'
def __init__(self, size, pdate):
self.size = size
self.pdate = pdate
def create_photo_name_dict(pdel):
photo_dictionary = {}
for photo in pdel:
photo_dictionary[photo[0]] = Photo(photo[1],datetime.date(photo[2:]).isoformat())
return photo_dictionary
create_photo_name_dict([["DSC315.JPG",55,2011,11,13],["DSC316.JPG",53,2011,11,12]])
这会产生TypeError: an integer is required。有什么问题?
【问题讨论】:
标签: python class dictionary