From ece1d828d53d6123fcecb5ea8bf9b126d1728ccc Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Fri, 24 Oct 2014 12:16:51 -0400 Subject: Add code --- facebook_scraping/mturk.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 facebook_scraping/mturk.py (limited to 'facebook_scraping/mturk.py') diff --git a/facebook_scraping/mturk.py b/facebook_scraping/mturk.py new file mode 100644 index 0000000..f6322da --- /dev/null +++ b/facebook_scraping/mturk.py @@ -0,0 +1,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") -- cgit v1.2.3-70-g09d2