From df0f008ae8754010fe54916cff6e5a658d7c5b94 Mon Sep 17 00:00:00 2001 From: webparameter Date: Tue, 21 Mar 2017 09:34:39 +0800 Subject: [PATCH] Changed all modes from 'wb' to 'w' to make it work for both Python and Python3 (#27) --- build/BUILD.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/BUILD.py b/build/BUILD.py index cc46fb9..8561723 100644 --- a/build/BUILD.py +++ b/build/BUILD.py @@ -8,6 +8,7 @@ split_on_tabs = re.compile(b'\t+').split + def main(): os.chdir(os.path.dirname(os.path.abspath(__file__))) if not os.path.isdir('../data'): @@ -53,7 +54,7 @@ def main(): print('Writing "titles.csv"') - with open('../data/titles.csv', 'wb') as f: + with open('../data/titles.csv', 'w') as f: output = csv.writer(f) output.writerow(('title', 'year')) for raw_title in interesting_titles: @@ -69,7 +70,7 @@ def main(): line = next(lines) assert next(lines) == b'==================\n' - output = csv.writer(open('../data/release_dates.csv', 'wb')) + output = csv.writer(open('../data/release_dates.csv', 'w')) output.writerow(('title', 'year', 'country', 'date')) for line in lines: @@ -100,7 +101,7 @@ def main(): print('Finished writing "release_dates.csv"') - output = csv.writer(open('../data/cast.csv', 'wb')) + output = csv.writer(open('../data/cast.csv', 'w')) output.writerow(('title', 'year', 'name', 'type', 'character', 'n')) for role_type, filename in ( @@ -188,6 +189,7 @@ def not_a_real_movie(line): match_title = re.compile(r'^(.*) \((\d+)(/[IVXL]+)?\)$').match + def parse_title(raw_title): try: title = raw_title.decode('ascii')