fork download
  1. import re
  2. text = "hi how are you\n\nhow you doing\nhow was your day"
  3. print(re.sub(r'(?<!\n)\n(?!\n)', ' ', text))
Success #stdin #stdout 0.01s 27712KB
stdin
Standard input is empty
stdout
hi how are you

how you doing how was your day