> For the complete documentation index, see [llms.txt](https://lei-d.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lei-d.gitbook.io/leetcode/data-structure/array.md).

# Matrix

Slicing

```python
>>> a=[[1,2,3],[4,5,6],[7,8,9]]

>>> a[0:2][0:2]    # this is wrong
[[1, 2, 3], [4, 5, 6]]

>>> [a[i][0:2] for i in range(0,2)]   # this is right
[[1, 2], [4, 5]]
```
