Last active
December 15, 2019 10:18
-
-
Save jigewxy/0b3b455a3c7d14a00571bb8ba0ad95d1 to your computer and use it in GitHub Desktop.
R in front of a raw string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
在Python的string前面加上‘r’, 是为了告诉编译器这个string是个raw string,不要转意backslash '\' 。 例如,\n 在raw string中,是两个字符,\和n, 而不会转意为换行符。由于正则表达式和 \ 会有冲突,因此,当一个字符串使用了正则表达式后,最好在前面加上'r'。 | |
———————————————— | |
版权声明:本文为CSDN博主「orzlzro」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 | |
原文链接:https://blog.csdn.net/orzlzro/article/details/6645909 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment