fork(1) download
  1. import re
  2. text = "今天特别 热,但是我买了 3 个西瓜。"
  3. print(re.sub(r'(?<=[^\W\d_])\s+(?=[^\W\d_])', '', text))
Success #stdin #stdout 0.02s 28384KB
stdin
Standard input is empty
stdout
今天特别热,但是我买了 3 个西瓜。