I have a CSV file with multiple rows and columns. I want to read the values into a two dimensional array so I can access each single value. There is a thread about how to read CSV files into an array which is this
When I try that code it still reads each row as one item into a list, which then I can't separate. Could you help with that?
The code I tried is this:
with open("filename.csv", newline='') as csvfile:
data = list(csv.reader(csvfile))
print(data)
The csv file's format is like this:
value1,value2,value3,value4
value5,value6,value7,value8
And the array that I get should be:
[[value1, value2, value3, value4]
[value5, value6, value7, value8]]
So when I say print(data[0,0])
it will print value1