clean up imports
This commit is contained in:
parent
934fd54009
commit
d566fedf4c
|
@ -31,6 +31,8 @@ def do(path=path):
|
|||
|
||||
def import_csv(path=csv_path):
|
||||
lines = csv.reader(open(path))
|
||||
|
||||
for line in lines:
|
||||
try:
|
||||
year = int(line[1].replace('"', '')[0:4])
|
||||
year_error = False
|
||||
|
@ -38,13 +40,12 @@ def import_csv(path=csv_path):
|
|||
year = None
|
||||
year_error = True
|
||||
|
||||
for line in lines:
|
||||
d = {
|
||||
'title': line[0],
|
||||
'title': line[0].strip(),
|
||||
'year': year,
|
||||
'director': line[2],
|
||||
'producer': line[3],
|
||||
'language': line[4],
|
||||
'director': line[2].replace('"', ''),
|
||||
'producer': line[3].replace('"', '').strip(),
|
||||
'language': line[4].replace('"', '').strip(),
|
||||
'year_error': year_error
|
||||
}
|
||||
f = Film(**d)
|
||||
|
|
Loading…
Reference in New Issue
Block a user