import re
frase = "O rato roeu a roupa\n Do rei de Roma"
nova_frase = re.sub(r"\s", "", frase)
print(nova_frase) # 'OratoroeuaroupaDoreideRoma'