diff --git a/task.py b/task.py index 863dffc..3da16db 100644 --- a/task.py +++ b/task.py @@ -50,7 +50,9 @@ def do_task(): word_amount = {} # print(word_amount) for word in word_list: - if word in ["。", ",", "!", ":", "“", "”", "!", ".", ",", ":", '"', "+", "-", "[", "]", "\\", "/"]: + if re.search( + r"[。|,|、|?|!|,|.|!|?|\\|/|+|\-|`|~|·|@|#|¥|$|%|^|&|*|(|)|;|;|‘|’|“|”|'|_|=|\"]", + word) is not None: continue # 判断该词是否之前已经出现 if word_amount.get(word) is not None: