私は以下のコードをPythonで実行して、単語のリストとその数をテキストファイルから生成しています。どのように私は1のカウントを持っている私の "frequency_list"変数から単語をフィルタリングに行きますか?またPythonで辞書/キーを変更する
、どのように私は、CSVに提供される任意の助けを事前に
感謝を底にprint文のループをエクスポートします。最初の部分については
import re
import string
frequency = {}
document_text = open('Words.txt', 'r')
text_string = document_text.read().lower()
match_pattern = re.findall(r'\b[a-z]{3,15}\b', text_string)
for word in match_pattern:
count = frequency.get(word,0)
frequency[word] = count + 1
frequency_list = frequency.keys()
for words in frequency_list:
print (words, frequency[words])
[1つのこれらの '' 'dict'''メソッドのうち、(https://docs.python.org/3/library/stdtypes.html#mapping-types-dict);あなたの状態の値をテストしてください。要件を満たすキーをコンテナ(リストなど)に格納する。 [csv module](https://docs.python.org/3/library/csv.html)を使用してCSVに書き込む – wwii