如何刪除以 '\ü......'蟒蛇刪除開頭寫着 'ü......'
count_all = Counter()
for sentence in tweets[:100]:
cleaned_terms = [term for term in preprocess(sentence.lower()) if term not in stop]
count_all.update(cleaned_terms)
print count_all.most_common(5)
輸出開始的所有條款:
#[(u'#halloween', 100), (u'\ud83d', 52), (u'\u2026', 28), (u'\ud83c', 24), (u'halloween', 14)]
您能給出一個可能的輸入和預期輸出的清晰例子嗎?我在這裏有點失落。你有「清理的代碼」。這個代碼不是做你想做的嗎?如果是這樣,怎麼樣(不?) – Floris
這些字符串不是以''\ u''開始的。你看到的是一個對象的可打印表示,由'repr'函數給出。 – roeland
如何以可讀格式打印它? – jxn