def append_table_to_file(fpath): fresh = True while True: linelist = dump_table_to_list() tab = flowTableParser.text2table(linelist) table_to_file(tab, fpath, fresh) fresh = False sleeptime = 5 print 'sleeping for ', sleeptime, 'seconds' time.sleep(sleeptime)
def parse_single_file(fpath): with open(fpath, 'r') as f: linelist = f.readlines() tab = flowTableParser.text2table(linelist) tab = [row for row in tab if row['n_packets'] != '0'] table_to_file(tab, fpath+'.parsed', freshfile=True)