diff --git a/docs/python.md b/docs/python.md index e6ec9cd..32a20e9 100644 --- a/docs/python.md +++ b/docs/python.md @@ -425,6 +425,19 @@ txt2 = "My name is {0}, I'm {1}".format("John", 36) txt3 = "My name is {}, I'm {}".format("John", 36) ``` +### 转义符号 + + +| 转义符号 | 对应的操作 | +|------|--------| +| `\\` | 输出反斜杠 | +| `\'` | 输出单引号 | +| `\"` | 输出双引号 | +| `\n` | 换行 | +| `\t` | 水平制表符 | +| `\r` | 光标回到首位 | +| `\b` | 退格 | + ### 控制台输入 ```python @@ -436,14 +449,8 @@ Enter your name: Tom 从控制台获取输入数据 -### 插入分隔符拼接 - -```python ->>> "、".join(["John", "Peter", "Vicky"]) -'John、Peter、Vicky' -``` - ### 头尾判断 + ```python >>> # 是否以 H 开头 @@ -457,17 +464,12 @@ False True ``` -### 转义符号 +### 插入分隔符拼接 -| 转义符号 | 对应的操作 | -|------|--------| -| `\\` | 输出反斜杠 | -| `\'` | 输出单引号 | -| `\"` | 输出双引号 | -| `\n` | 换行 | -| `\t` | 水平制表符 | -| `\r` | 光标回到首位 | -| `\b` | 退格 | +```python +>>> "、".join(["John", "Peter", "Vicky"]) +'John、Peter、Vicky' +``` Python f-字符串 (Python 3.6+) ----------------