Pythonで余計な文字列を置き換え・削除するにはreを利用します。
re.sub(置き換える表現, 置き換え後の文字, 元の文字列)
import re
def format_text(text):
'''
MeCabに入れる前のツイートの整形方法例
'''
text=re.sub(r'https?://[\w/:%#\$&\?\(\)~\.=\+\-…]+', "", text)
text=re.sub('RT', "", text)
text=re.sub('お気に入り', "", text)
text=re.sub('まとめ', "", text)
text=re.sub(r'[!-~]', "", text)#半角記号,数字,英字
text=re.sub(r'[︰-@]', "", text)#全角記号
text=re.sub('\n', " ", text)#改行文字
return text
print(format_text("テストtest\nhttp:hoge.com"))
実行結果
テスト


