File size: 157 Bytes
284ba3b
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9

import re

def clean_text(text):
    text = text.strip()
    text = re.sub(r'[\n\r\t]', ' ', text)
    text = re.sub(r'[ ]{2,}', ' ', text)
    return text