How do you split reading a large csv file into evenly-sized chunks in Python?

Just make your reader subscriptable by wrapping it into a list. Obviously this will break on really large files (see alternatives in the Updates below): >>> reader = csv.reader(open(‘big.csv’, ‘rb’)) >>> lines = list(reader) >>> print lines[:100] … Further reading: How do you split a list into evenly sized chunks in Python? Update 1 (list … Read more