import retext = "hi how are you\n\nhow you doing\nhow was your day"print(re.sub(r'(?<!\n)\n(?!\n)', ' ', text))
Standard input is empty
hi how are you how you doing how was your day
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!