Split string with multiple-character delimiter

前端 未结 3 605
慢半拍i
慢半拍i 2020-12-01 23:47

say I have the following string:

"Hello there. My name is Fred. I am 25.5 years old."

I want to split this into sentences, so that

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 00:10

    You can use split function in regular expression library :

    import re
    re.split('\. ', "Hello there. My name is Fred. I am 25.5 years old.")
    

提交回复
热议问题