def write(file, n=1000): before = time.clock() writer = dataharvester.SystemWriter(file) for i in range(n): writer.save() dataharvester.Writer_close(file) secs = time.clock() - before print file, " ", secs
def convert(infiles, outfile): for i in infiles: print i, print "->", outfile w = dataharvester.Writer_file(outfile) for infile in infiles: r = dataharvester.Reader_file(infile) try: while True: tpl = r.next() w.save(tpl) except StopIteration, e: pass dataharvester.Writer_close() if __name__ == '__main__': import argparse, types argparser = argparse.ArgumentParser( description='convert n input files into one output file') argparser.add_argument('infiles', type=types.StringType, nargs='+', help='input file names') argparser.add_argument('outfile', type=types.StringType, nargs=1, help='output file name') argparser.add_argument('-V',
def write(filename, tuplename, what=dataharvester.SystemWriter.Everything): w = dataharvester.SystemWriter(filename) w.save(what, tuplename) dataharvester.Writer_close()