summaryrefslogtreecommitdiffstats
path: root/facebook_scraping/mturk.py
blob: f6322daa3030ed8d7d8e51a3fc935910c0e3600c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import csv
import os.path as op
from glob import glob

for fname in glob("*.csv"):
    with open(fname) as f:
        reader = csv.reader(f)
        oname, _ = op.splitext(fname)
        oname = oname + ".txt"
        with open(oname, "w") as of:
            for i, row in enumerate(reader):
                if i == 0:
                    continue
                if row[-1] == "":
                    row = row[:-1]
                of.write("\t".join(row) + "\n")