-1

How would I do this in python3?

The            quick     brown                fox jumps over the  lazy dog.

to...

The quick brown fox jumps over the lazy dog.

Where the above quote is a string.

1 Answers1

0

You don't need to use regex here. You can achieve what you want like this ways:

a = "The            quick     brown                fox jumps over the  lazy dog."
final = " ".join(a.split())
print(final) 

Output:

'The quick brown fox jumps over the lazy dog.'
Chiheb Nexus
  • 9,104
  • 4
  • 30
  • 43