Remove small words using Python

前端 未结 2 868
醉酒成梦
醉酒成梦 2020-12-03 14:12

Is it possible use regex to remove small words in a text? For example, I have the following string (text):

anytext = \" in the echo chamber from Ontario duo          


        
2条回答
  •  忘掉有多难
    2020-12-03 14:35

    I don't think you need a regex for this simple example anyway ...

    ' '.join(word for word in anytext.split() if len(word)>3)
    

提交回复
热议问题