Split Strings into words with multiple word boundary delimiters

前端 未结 30 2749
既然无缘
既然无缘 2020-11-21 05:09

I think what I want to do is a fairly common task but I\'ve found no reference on the web. I have text with punctuation, and I want a list of the words.

\"H         


        
30条回答
  •  星月不相逢
    2020-11-21 05:59

    got same problem as @ooboo and find this topic @ghostdog74 inspired me, maybe someone finds my solution usefull

    str1='adj:sg:nom:m1.m2.m3:pos'
    splitat=':.'
    ''.join([ s if s not in splitat else ' ' for s in str1]).split()
    

    input something in space place and split using same character if you dont want to split at spaces.

提交回复
热议问题