Python create list of objects from multiple files showing intersection
问题 I'm reading from two files (lists of datetimes), called A and B. (not necessarily in order) I'd like to create a list of these datetimes as objects: class AB(object): def __init__(self, datetime, a=False, b=False): self.datetime = datetime self.a = a self.b = b a should be set to true if the datetime exists in file A, and b true if datetime exists in file B. (false otherwise) For example: file A: 20111225, 20111226 file B: 20111225, 20111227 List of objects should be: AB(20111225, a = true, b