code: def mergecsv(args):
      
      p = OptionParser(mergecsv.__doc__)
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) < 2:
          sys.exit(not p.print_help())
  
      tsvfiles = args
      outfile = opts.outfile
  
      if op.exists(outfile):
          os.remove(outfile)
  
      tsvfile = tsvfiles[0]
      fw = must_open(opts.outfile, "w")
      for i, tsvfile in enumerate(tsvfiles):
          fp = open(tsvfile)
          if i > 0:
              next(fp)
          for row in fp:
              fw.write(row)
      fw.close()
docs: %prog mergecsv *.tsv
  
      Merge a set of tsv files.