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):
|
def import_csv(path=csv_path):
|
||||||
lines = csv.reader(open(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:
|
for line in lines:
|
||||||
|
try:
|
||||||
|
year = int(line[1].replace('"', '')[0:4])
|
||||||
|
year_error = False
|
||||||
|
except:
|
||||||
|
year = None
|
||||||
|
year_error = True
|
||||||
|
|
||||||
d = {
|
d = {
|
||||||
'title': line[0],
|
'title': line[0].strip(),
|
||||||
'year': year,
|
'year': year,
|
||||||
'director': line[2],
|
'director': line[2].replace('"', ''),
|
||||||
'producer': line[3],
|
'producer': line[3].replace('"', '').strip(),
|
||||||
'language': line[4],
|
'language': line[4].replace('"', '').strip(),
|
||||||
'year_error': year_error
|
'year_error': year_error
|
||||||
}
|
}
|
||||||
f = Film(**d)
|
f = Film(**d)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user