Skip to content
Snippets Groups Projects
Commit fbed0cb1 authored by Christophe Benz's avatar Christophe Benz
Browse files

Strip only "\n" in TSV lines

parent b2ca0d9c
No related branches found
No related tags found
No related merge requests found
......@@ -323,7 +323,9 @@ def iter_tsv_rows(tsv_io):
>>> test("")
[]
>>> test(" ")
[]
[[' ']]
>>> test("period\tvalue")
[['period', 'value']]
>>> test("period\tvalue\n")
[['period', 'value']]
>>> test("period\tvalue\n2018\t0.2")
......@@ -332,9 +334,11 @@ def iter_tsv_rows(tsv_io):
[['period', 'value'], ['2018', '0.2']]
>>> test("period\tvalue\tattribute1\n2018\t0.2\tZ\n")
[['period', 'value', 'attribute1'], ['2018', '0.2', 'Z']]
>>> test("period\tvalue\tstatus\n\n2017\t0.1\t\n2018\t0.2\tE")
[['period', 'value', 'status'], ['2017', '0.1', ''], ['2018', '0.2', 'E']]
"""
for line in tsv_io:
line = line.strip()
line = line.strip('\n')
if not line:
continue
cells = line.split("\t")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment