def addToFile(self): """ Save the name and the number of the contacts to a text file """ ac=AgendaController() group=raw_input('Group:').strip() while group<>'Family' and group<>'Friends' and group<>'Others': print 'INVALID GROUP' group=raw_input('Group:').strip() list=ac.lookUpAll(group) outFile=raw_input('FileName:').strip() try: ac.exportCSV(group, outFile) except IOError: print "File not found"
def showGroup(self): """ Show all the contacts from the group """ ac=AgendaController() group=raw_input('Group:').strip() while group<>'Family' and group<>'Friends' and group<>'Others': print 'INVALID GROUP' group=raw_input('Group:').strip() list=ac.lookUpAll(group) if list==[]: print 'EMPTY GROUP' else: for i in list: print i.getName(),': ',i.getPhoneNr()