Thursday, August 7, 2014

Python csv.reader to list

Quickly 'convert' a Python csv.reader object into a list (for instance to bulk insert using ceODBC).

*You may or may not need the .splitlines() call depending on the csv.


list = [row for row in csv.reader(csv_file.splitlines())][1:]



No comments:

Post a Comment