view tsv.py @ 3:134bb2d7cdfd draft

planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author cpt
date Mon, 05 Jun 2023 02:43:21 +0000
parents
children
line wrap: on
line source

import sys


# Like 'import json' / 'import yaml', except.. tab data.
def loads(str_data):
    return NotImplementedError()


def load(handle):
    return NotImplementedError()


def dump(data, handle=sys.stdout):
    for row in data:
        handle.write("%s\n" % "\t".join(map(str, row)))


def dumps(data):
    output = ""
    for row in data:
        output += "%s\n" % "\t".join(map(str, row))
    return output


def dump_line(row, handle=sys.stdout):
    dump([row], handle=handle)


def dumps_line(row):
    return dumps([row])