如何使用Python正则表达式匹配制表符和换行符,但不匹配空格?
下面的代码使用正则表达式从给定的字符串匹配制表符和换行符,但不匹配空格。
阅读更多:Python 教程
例子
import re
print re.findall(r"[\n\t]","""I find
Tutorialspoint useful""")
输出
这将输出
['\n']
下面的代码使用正则表达式从给定的字符串匹配制表符和换行符,但不匹配空格。
阅读更多:Python 教程
import re
print re.findall(r"[\n\t]","""I find
Tutorialspoint useful""")
这将输出
['\n']