def check_load_file(filename, files): if not os.path.exists(filename) or not os.path.isfile(filename): print 'Error can not find the specified file' return filetype = filename.split('.')[1] if filetype == 'csv': csv_data = CSVData(filename) csv_data.parse_vectors() files.append(csv_data) elif filetype == 'txt': txt_data = TXTData(filename) txt_data.read_document() files.append(txt_data) else: print 'Error unrecognized file type ', filetype return print 'Parsed file: ', filename