doc: update docs/python.md
This commit is contained in:
parent
4020036f93
commit
86d4e8bea5
@ -425,6 +425,19 @@ txt2 = "My name is {0}, I'm {1}".format("John", 36)
|
|||||||
txt3 = "My name is {}, I'm {}".format("John", 36)
|
txt3 = "My name is {}, I'm {}".format("John", 36)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 转义符号
|
||||||
|
<!--rehype:wrap-class=row-span-2-->
|
||||||
|
|
||||||
|
| 转义符号 | 对应的操作 |
|
||||||
|
|------|--------|
|
||||||
|
| `\\` | 输出反斜杠 |
|
||||||
|
| `\'` | 输出单引号 |
|
||||||
|
| `\"` | 输出双引号 |
|
||||||
|
| `\n` | 换行 |
|
||||||
|
| `\t` | 水平制表符 |
|
||||||
|
| `\r` | 光标回到首位 |
|
||||||
|
| `\b` | 退格 |
|
||||||
|
|
||||||
### 控制台输入
|
### 控制台输入
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -436,14 +449,8 @@ Enter your name: Tom
|
|||||||
|
|
||||||
从控制台获取输入数据
|
从控制台获取输入数据
|
||||||
|
|
||||||
### 插入分隔符拼接
|
|
||||||
|
|
||||||
```python
|
|
||||||
>>> "、".join(["John", "Peter", "Vicky"])
|
|
||||||
'John、Peter、Vicky'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 头尾判断
|
### 头尾判断
|
||||||
|
<!--rehype:wrap-class=row-span-2-->
|
||||||
|
|
||||||
```python
|
```python
|
||||||
>>> # 是否以 H 开头
|
>>> # 是否以 H 开头
|
||||||
@ -457,17 +464,12 @@ False
|
|||||||
True
|
True
|
||||||
```
|
```
|
||||||
|
|
||||||
### 转义符号
|
### 插入分隔符拼接
|
||||||
|
|
||||||
| 转义符号 | 对应的操作 |
|
```python
|
||||||
|------|--------|
|
>>> "、".join(["John", "Peter", "Vicky"])
|
||||||
| `\\` | 输出反斜杠 |
|
'John、Peter、Vicky'
|
||||||
| `\'` | 输出单引号 |
|
```
|
||||||
| `\"` | 输出双引号 |
|
|
||||||
| `\n` | 换行 |
|
|
||||||
| `\t` | 水平制表符 |
|
|
||||||
| `\r` | 光标回到首位 |
|
|
||||||
| `\b` | 退格 |
|
|
||||||
|
|
||||||
Python f-字符串 (Python 3.6+)
|
Python f-字符串 (Python 3.6+)
|
||||||
----------------
|
----------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user