Code:def read_all_files(): global files_and_lines for files in constants.FILE_NAMES: fpath = os.path.join((sys.path[0]),"lexi", files) try: lexi_file = open(fpath, "r") constants.files_and_lines.append(lexi_file.readlines()) except(IOError): print "Something went wrong trying to read the file:" print "'%s'" % fpath lexi_file.close()




Reply With Quote