diff options
| author | Adam Harvey <adam@ahprojects.com> | 2018-12-23 01:37:03 +0100 |
|---|---|---|
| committer | Adam Harvey <adam@ahprojects.com> | 2018-12-23 01:37:03 +0100 |
| commit | 4452e02e8b04f3476273574a875bb60cfbb4568b (patch) | |
| tree | 3ffa44f9621b736250a8b94da14a187dc785c2fe /util.py | |
| parent | 2a65f7a157bd4bace970cef73529867b0e0a374d (diff) | |
| parent | 5340bee951c18910fd764241945f1f136b5a22b4 (diff) | |
.
Diffstat (limited to 'util.py')
| -rw-r--r-- | util.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/util.py b/util.py deleted file mode 100644 index dae3f67c..00000000 --- a/util.py +++ /dev/null @@ -1,31 +0,0 @@ -import os -import csv -import simplejson as json - -def read_citation_list(index=0): - filename = './datasets/citations.csv' - if index > 0: - fn, ext = os.path.splitext(filename) - filename = fn + '-' + str(index) + ext - with open(filename, 'r') as f: - reader = csv.reader(f) - lines = list(reader) - keys = lines[0] - lines = lines[1:] - return keys, lines - -def read_json(fn): - with open(fn, 'r') as json_file: - return json.load(json_file) - -def write_json(fn, data): - with open(fn, 'w') as outfile: - json.dump(data, outfile) - -def write_csv(fn, keys, rows): - with open(fn, 'w') as f: - writer = csv.writer(f) - if keys is not None: - writer.writerow(keys) - for row in rows: - writer.writerow(row) |
