Arrays 从python 3中的csv文件创建二维数组

Arrays 从python 3中的csv文件创建二维数组,arrays,csv,python-3.x,Arrays,Csv,Python 3.x,我有一个.csv文件,其中包含如下示例所示的数据 A,B,C,D,E,F, 1,-1.978,7.676,7.676,7.676,0, 2,-2.028,6.081,6.081,6.081,1, 3,-1.991,6.142,6.142,6.142,1, 4,-1.990,65.210,65.210,65.210,5, 5,-2.018,8.212,8.212,8.212,5, 6,54.733,32.545,32.545,32.545,6, ..and so on 格式是固定的 我想将文件加

我有一个.csv文件,其中包含如下示例所示的数据

A,B,C,D,E,F,
1,-1.978,7.676,7.676,7.676,0,
2,-2.028,6.081,6.081,6.081,1,
3,-1.991,6.142,6.142,6.142,1,
4,-1.990,65.210,65.210,65.210,5,
5,-2.018,8.212,8.212,8.212,5,
6,54.733,32.545,32.545,32.545,6,
..and so on
格式是固定的

我想将文件加载到变量“log”中,并以log[row][column]的形式访问它们

example
log[0][2] should give C
log[3][1] should give -1
如果使用此代码

file = open('log.csv')
log = list(file)
当我使用这个代码时,我只得到一维。日志[行]

他们有没有直接储存的方法

比如说

read the file
split with '\n'
split again with ','
谢谢

试试这个

log = [line.split(',') for line in open('log.csv')]

工作完美!!非常感谢。