Skip to content

Instantly share code, notes, and snippets.

Created August 17, 2013 15:20
Show Gist options
  • Save anonymous/6257394 to your computer and use it in GitHub Desktop.
Save anonymous/6257394 to your computer and use it in GitHub Desktop.
test
import csv
with open('BSE2.tsv', newline='') as tsvfile:
spamreader = csv.reader(tsvfile, delimiter='\t')
labels = next(spamreader)
print(labels)
with open('BSE3.tsv', 'w') as out_file:
out_file.write("\t".join(labels) + "\n")
previous = []
for idx, row in enumerate(spamreader):
time = row[0]
values = row[1:]
if previous == values:
previous = values
continue
previous = values
line = time + "\t" + "\t".join(values)
print(line)
out_file.write(line + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment