Skip to content

Instantly share code, notes, and snippets.

@jigewxy
Last active December 15, 2019 10:18
Show Gist options
  • Save jigewxy/0b3b455a3c7d14a00571bb8ba0ad95d1 to your computer and use it in GitHub Desktop.
Save jigewxy/0b3b455a3c7d14a00571bb8ba0ad95d1 to your computer and use it in GitHub Desktop.
R in front of a raw string
在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