clean up imports
This commit is contained in:
parent
934fd54009
commit
d566fedf4c
|
@ -31,20 +31,21 @@ def do(path=path):
|
|||
|
||||
def import_csv(path=csv_path):
|
||||
lines = csv.reader(open(path))
|
||||
try:
|
||||
year = int(line[1].replace('"', '')[0:4])
|
||||
year_error = False
|
||||
except:
|
||||
year = None
|
||||
year_error = True
|
||||
|
||||
for line in lines:
|
||||
try:
|
||||
year = int(line[1].replace('"', '')[0:4])
|
||||
year_error = False
|
||||
except:
|
||||
year = None
|
||||
year_error = True
|
||||
|
||||
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