Skip to content

Commit

Permalink
doc: update docs/python.md (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
aixcyi committed Jul 31, 2023
1 parent 07f6747 commit 5b11b6e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ IndexError: list index out of range
['re', 're', 're']
```

### 搜索
### 搜索

```python
>>> nums = [40, 36, 89, 2, 36, 100, 7, -20.5, -999]
Expand All @@ -764,6 +764,7 @@ IndexError: list index out of range
>>> nums.index(7, 4) # 搜索4之后的元素
6
```

当寻找一个不存在的值时,抛出`ValueError`

Python 判断
Expand Down Expand Up @@ -1223,12 +1224,12 @@ print(string * times) # => hahaha
### 变量

```python
result: int = 1 + 2
result: str = 1 + 2

print(result) # => 3
```

虽然标注了错误的类型,但不影响正常运行
错误的类型标注不会影响正常运行,也不会报错

### 参数

Expand Down

0 comments on commit 5b11b6e

Please sign in to comment.