# part 函数

按位置（从 1 开始计数）读取列表的一部分；也可写作 list\[i\]。

## 怎么写

### part(list, i)

一个元素。

**list**

列表。接受一个列表。

**i**

位置。接受一个整数。

### part(list, i, j)

列表的列表中的一个元素。

**list**

列表的列表。接受一个列表。

**i**

行。接受一个整数。

**j**

列。接受一个整数。

## 示例

- $\displaystyle \operatorname{part}(\left[ 10, 20, 30 \right], 2) = 20$

  `part([10, 20, 30], 2)`

  在求解器中，`part([10, 20, 30], 2)` 的结果是 `20`。

  [在求解器中打开](https://zh.hilberon.com/?q=part%28%5B10%2C%2020%2C%2030%5D%2C%202%29)
- $\displaystyle \operatorname{part}\left(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, 2, 1\right) = 3$

  `part([[1, 2], [3, 4]], 2, 1)`

  在求解器中，`part([[1, 2], [3, 4]], 2, 1)` 的结果是 `3`。

  [在求解器中打开](https://zh.hilberon.com/?q=part%28%5B%5B1%2C%202%5D%2C%20%5B3%2C%204%5D%5D%2C%202%2C%201%29)

## 相关函数

- [replace_part](https://zh.hilberon.com/library/replace_part)

  把某个位置上的部分替换后的列表；写作 position -> value。
- [partition](https://zh.hilberon.com/library/partition)

  将列表按给定长度拆分为若干块。
- [nest_list](https://zh.hilberon.com/library/nest_list)

  nest 的各个步骤：每次应用后的值，从第一次开始。
- [position](https://zh.hilberon.com/library/position)

  某个值在列表中出现的位置，以位置列表表示。
- [nest](https://zh.hilberon.com/library/nest)

  对一个值反复应用函数。
- [prepend](https://zh.hilberon.com/library/prepend)

  在开头添加一个元素后的列表。

---
Source: https://zh.hilberon.com/library/part
