8
8
9
9
split_on_tabs = re .compile (b'\t +' ).split
10
10
11
+
11
12
def main ():
12
13
os .chdir (os .path .dirname (os .path .abspath (__file__ )))
13
14
if not os .path .isdir ('../data' ):
@@ -53,7 +54,7 @@ def main():
53
54
54
55
print ('Writing "titles.csv"' )
55
56
56
- with open ('../data/titles.csv' , 'wb ' ) as f :
57
+ with open ('../data/titles.csv' , 'w ' ) as f :
57
58
output = csv .writer (f )
58
59
output .writerow (('title' , 'year' ))
59
60
for raw_title in interesting_titles :
@@ -69,7 +70,7 @@ def main():
69
70
line = next (lines )
70
71
assert next (lines ) == b'==================\n '
71
72
72
- output = csv .writer (open ('../data/release_dates.csv' , 'wb ' ))
73
+ output = csv .writer (open ('../data/release_dates.csv' , 'w ' ))
73
74
output .writerow (('title' , 'year' , 'country' , 'date' ))
74
75
75
76
for line in lines :
@@ -100,7 +101,7 @@ def main():
100
101
101
102
print ('Finished writing "release_dates.csv"' )
102
103
103
- output = csv .writer (open ('../data/cast.csv' , 'wb ' ))
104
+ output = csv .writer (open ('../data/cast.csv' , 'w ' ))
104
105
output .writerow (('title' , 'year' , 'name' , 'type' , 'character' , 'n' ))
105
106
106
107
for role_type , filename in (
@@ -188,6 +189,7 @@ def not_a_real_movie(line):
188
189
189
190
match_title = re .compile (r'^(.*) \((\d+)(/[IVXL]+)?\)$' ).match
190
191
192
+
191
193
def parse_title (raw_title ):
192
194
try :
193
195
title = raw_title .decode ('ascii' )
0 commit comments