##### 标题：Python - 二维数组

```Day 1 - 11 12 5 2
Day 2 - 15 6 10
Day 3 - 10 8 12 5
Day 4 - 12 15 8 6
```

```T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]
```

## 访问二维数组中的值

```from array import *

T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]
print(T[0])
print(T[1][2])
```

```[11, 12, 5, 2]
10
```

```from array import *

T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]
for r in T:
for c in r:
print(c,end = " ")
print()
```

```11 12 5 2
15 6 10
10 8 12 5
12 15 8 6
```

## 在二维数组中插入值

```from array import *
T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]

T.insert(2, [0,5,11,13,6])

for r in T:
for c in r:
print(c,end = " ")
print()
```

```11 12 5 2
15 6 10
0 5 11 13 6
10 8 12 5
12 15 8 6
```

## 更新二维数组中的值

```from array import *

T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]

T[2] = [11,9]
T[0][3] = 7
for r in T:
for c in r:
print(c,end = " ")
print()
```

```11 12 5 7
15 6 10
11 9
12 15 8 6
```

## 删除二维数组中的值

```from array import *
T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]

del T[3]

for r in T:
for c in r:
print(c,end = " ")
print()
```

```11 12 5 2
15 6 10
10 8 12 5
```