def dump(args):
    '\n    %prog dump fastafile\n\n    Convert FASTA sequences to list of K-mers.\n    '
    p = OptionParser(dump.__doc__)
    p.add_option('-K', default=23, type='int', help='K-mer size')
    p.set_outfile()
    (opts, args) = p.parse_args(args)
    if (len(args) != 1):
        sys.exit((not p.print_help()))
    (fastafile,) = args
    K = opts.K
    fw = must_open(opts.outfile, 'w')
    f = Fasta(fastafile, lazy=True)
    for (name, rec) in f.iteritems_ordered():
        kmers = list(make_kmers(rec.seq, K))
        print('\n'.join(kmers), file=fw)
    fw.close()
%prog dump fastafile

Convert FASTA sequences to list of K-mers.
def dump(args):
    '\n    %prog dump fastafile\n\n    Convert FASTA sequences to list of K-mers.\n    '
    p = OptionParser(dump.__doc__)
    p.add_option('-K', default=23, type='int', help='K-mer size')
    p.set_outfile()
    (opts, args) = p.parse_args(args)
    if (len(args) != 1):
        sys.exit((not p.print_help()))
    (fastafile,) = args
    K = opts.K
    fw = must_open(opts.outfile, 'w')
    f = Fasta(fastafile, lazy=True)
    for (name, rec) in f.iteritems_ordered():
        kmers = list(make_kmers(rec.seq, K))
        print('\n'.join(kmers), file=fw)
    fw.close()