Dictations are quick, but can be hard to remember. Usually this should not be a problem, but you will only know when testing. I would suggest testing 1,000 lines, 10,000 lines, etc. first. And look at the amount of memory.
If you run out of memory and your data structure allows, perhaps try using named tuples .
EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade') import csv for emp in map(EmployeeRecord._make, csv.reader(open("employees.csv", "rb"))): print(emp.name, emp.title)
(Example taken from the link)
If you have ascending integers, you can also try to get more fancy using the array module .
source share