【问题标题】:Split string by both newline and full stop? [duplicate]用换行符和句号分割字符串? [复制]
【发布时间】:2020-07-06 15:06:43
【问题描述】:

如果我有一个像test string. something \n else 这样的字符串,我将如何将字符串拆分为.\n 字符?我尝试过使用re.split(". \n", text),但它似乎不起作用。

【问题讨论】:

    标签: python python-3.x regex


    【解决方案1】:

    想通了 - 我需要使用 re.split("\\.|\n", text)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-16
      • 2014-09-23
      • 2014-11-10
      • 2022-07-06
      • 1970-01-01
      • 2019-03-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多