-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
Description
r+字符串:非转义的原始字符串。
正则表达式使用反斜线字符 \ 来表示转义字符,例如 \n 表示换行, \t 表示 Tab 等。
在带有 r 前缀的字符串字面值中,反斜杠 \ 不必做任何特殊处理。因此 r"\n" 表示包含 \ 和 n 两个字符的字符串(非转义的原始字符串 ),而不是表示换行。
r'string' 的形式,常用于 regex 正则表达式,对应着 re 模块。