【发布时间】:2020-07-06 15:06:43
【问题描述】:
如果我有一个像test string. something \n else 这样的字符串,我将如何将字符串拆分为. 和\n 字符?我尝试过使用re.split(". \n", text),但它似乎不起作用。
【问题讨论】:
标签: python python-3.x regex
如果我有一个像test string. something \n else 这样的字符串,我将如何将字符串拆分为. 和\n 字符?我尝试过使用re.split(". \n", text),但它似乎不起作用。
【问题讨论】:
标签: python python-3.x regex
想通了 - 我需要使用 re.split("\\.|\n", text)。
【讨论】: