comparison tsv.py @ 3:134bb2d7cdfd draft

planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author cpt
date Mon, 05 Jun 2023 02:43:21 +0000
parents
children
comparison
equal deleted inserted replaced
2:787ce84e8d16 3:134bb2d7cdfd
1 import sys
2
3
4 # Like 'import json' / 'import yaml', except.. tab data.
5 def loads(str_data):
6 return NotImplementedError()
7
8
9 def load(handle):
10 return NotImplementedError()
11
12
13 def dump(data, handle=sys.stdout):
14 for row in data:
15 handle.write("%s\n" % "\t".join(map(str, row)))
16
17
18 def dumps(data):
19 output = ""
20 for row in data:
21 output += "%s\n" % "\t".join(map(str, row))
22 return output
23
24
25 def dump_line(row, handle=sys.stdout):
26 dump([row], handle=handle)
27
28
29 def dumps_line(row):
30 return dumps([row])