How to read lines from a CSV variable into a multidimensional array in python?
csv, multidimensional-array, python, python-2.7
Solution
>>> import csv
>>> result = [row for row in csv.reader(x.splitlines(), delimiter=';')]
>>> import pprint
>>> pprint.pprint(result)
[['High', '10', 'Assigned', '2012/06/12 10:11:02'],
['Low', '20', 'Assigned', '2012/06/12 10:11:02'],
['Medium', '30', 'Assigned', '2012/06/12 10:11:02']]
Problem
The string looks like this: ``` x = '''"High";"10";"Assigned";"2012/06/12 10:11:02" "Low";"20";"Assigned";"2012/06/12 10:11:02" "Medium";"30";"Assigned";"2012/06/12 10:11:02"''' ``` I want it to be like this: ``` x = [ [High, 10, Assigned, 2012/06/12 10:11:02], [Low, 20, Assigned, 2012/06/12 10:11:02], [Medium, 30, Assigned, 2012/06/12 10:11:02]] ``` Whats the best way to parse this?