def addressBookImport(self, fileName, app): if os.path.exists(fileName): f = open(fileName, 'r') data = utils.importParse(f) for element in data: newContact = contact(element['Recipient']) newAddress = address(element['Last'], element['Delivery'], element['Second']) newContact.addAddress(newAddress) if 'Phone' in element: newContact.addPhoneNumber(element['Phone']) if 'Email' in element: newContact.addEmail(element['Email']) self.addContact(newContact) app.cmdUpdateListbox(self.contacts)
def main(): print sys.argv f = open(sys.argv[1], 'rb') d = utils.importParse(f) print d