Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python字符串前加r #109

Open
Qingquan-Li opened this issue Jan 26, 2019 · 0 comments
Open

Python字符串前加r #109

Qingquan-Li opened this issue Jan 26, 2019 · 0 comments
Labels

Comments

@Qingquan-Li
Copy link
Owner

r+字符串:非转义的原始字符串。

正则表达式使用反斜线字符 \ 来表示转义字符,例如 \n 表示换行, \t 表示 Tab 等。

在带有 r 前缀的字符串字面值中,反斜杠 \ 不必做任何特殊处理。因此 r"\n" 表示包含 \n 两个字符的字符串(非转义的原始字符串 ),而不是表示换行。

r'string' 的形式,常用于 regex 正则表达式,对应着 re 模块

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant