I have a script that uses a .csv
file into insert data to the Django model. Now, I wonder if there's a better way of doing this.
with open('some/path/to/file.csv') as f:
reader = csv.reader(f, delimiter=',')
header = reader.next()
for row in reader:
Foo.objects.create(first_name=row[0], last_name=row[1])
That's basically what it does. I just wonder if it can be refactored somehow.