Skip to content

Commit e6b45f5

Browse files
author
暮晨
committed
EX.Backslashes at the end of string
1 parent 8043322 commit e6b45f5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ So, here we go...
3636
- [> The sticky output function/麻烦的输出](#-the-sticky-output-function麻烦的输出)
3737
- [> `is not ...` is not `is (not ...)`/`is not ...` 不是 `is (not ...)`](#-is-not--is-not-is-not-is-not--不是-is-not-)
3838
- [> The surprising comma/意外的逗号](#-the-surprising-comma意外的逗号)
39-
- [> Backslashes at the end of string](#-backslashes-at-the-end-of-string)
39+
- [> Backslashes at the end of string/字符串末尾的反斜杠](#-backslashes-at-the-end-of-string字符串末尾的反斜杠)
4040
- [> not knot!](#-not-knot)
4141
- [> Half triple-quoted strings](#-half-triple-quoted-strings)
4242
- [> Midnight time doesn't exist?](#-midnight-time-doesnt-exist)
@@ -649,7 +649,7 @@ SyntaxError: invalid syntax
649649
- **注意:** 尾随逗号的问题已经在Python 3.6中被[修复](https://bugs.python.org/issue9232)了. 而这篇[帖子](https://bugs.python.org/issue9232#msg248399)中则简要讨论了Python中尾随逗号的不同用法.
650650
---
651651
652-
### > Backslashes at the end of string
652+
### > Backslashes at the end of string/字符串末尾的反斜杠
653653
654654
**Output:**
655655
```
@@ -665,14 +665,14 @@ SyntaxError: invalid syntax
665665
SyntaxError: EOL while scanning string literal
666666
```
667667
668-
#### 💡 Explanation
668+
#### 💡 说明:
669669
670-
- In a raw string literal, as indicated by the prefix `r`, the backslash doesn't have the special meaning.
670+
- 在以 `r` 开头的原始字符串中, 反斜杠并没有特殊含义.
671671
```py
672672
>>> print(repr(r"wt\"f"))
673673
'wt\\"f'
674674
```
675-
- What the interpreter actually does, though, is simply change the behavior of backslashes, so they pass themselves and the following character through. That's why backslashes don't work at the end of a raw string.
675+
- 解释器所做的只是简单的改变了反斜杠的行为, 因此会直接放行反斜杠及后一个的字符. 这就是反斜杠在原始字符串末尾不起作用的原因.
676676
677677
---
678678

0 commit comments

Comments
 (0)