如何使用 Python 正则表达式按换行符的连续性进行拆分?
pythonserver side programmingprogramming更新于 2025/7/7 16:12:17
以下代码使用 Python 正则表达式按以下字符串中的换行符的连续性进行拆分
示例
import re s = """I find Tutorialspoint useful""" print re.split(r"[\n]", s)
输出
这给出了输出
['I find', ' Tutorialspoint', ' useful']
相关文章
有用资源
python 参考教程 - 该教程包含有关 python 的更多信息:https://www.cainiaomax.com/python/

