Python: Split unicode string on word boundaries

前端 未结 9 1132
清酒与你
清酒与你 2020-12-31 13:16

I need to take a string, and shorten it to 140 characters.

Currently I am doing:

if len(tweet) > 140:
    tweet = re.sub(r\"\\s+\", \" \", tweet)          


        
9条回答
提交回复
热议问题