如何使用 Python 正则表达式匹配空格和换行符?
pythonserver side programmingprogramming更新于 2025/7/7 17:48:17
以下使用 Python 正则表达式匹配并打印给定字符串中的空格和换行符
示例
import re foo = ' I find Tutorialspoint useful' result = re.findall(r'\s+', foo) print result
输出
这给出了输出
[' ', ' ', ' \n ', ' \n ']
相关文章
有用资源
python 参考教程 - 该教程包含有关 python 的更多信息:https://www.cainiaomax.com/python/

