From b923d805e3d97dbf0ad0456a6c3621513580191c Mon Sep 17 00:00:00 2001 From: ghaa0920 <1554137355@qq.com> Date: Thu, 8 Jun 2023 15:26:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E6=94=B9=E4=BA=86=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E6=AD=A3=E5=B8=B8=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E5=8D=95=E8=AF=8D=E5=89=8D=E5=90=8E=E5=A4=9A=E4=BD=99=E7=9A=84?= =?UTF-8?q?=E8=BF=9E=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/wordfreqCMD.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/wordfreqCMD.py b/app/wordfreqCMD.py index 501b0c8..4a7134d 100644 --- a/app/wordfreqCMD.py +++ b/app/wordfreqCMD.py @@ -43,8 +43,9 @@ def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用 cop = re.compile("[^-^a-z^A-Z^\\']") # 通过正则表达式保留英文字符和'特殊字符 s = cop.sub(' ', s) - s = s.strip('-') #去除头尾连字符 + s = s.strip('--') #去除头尾连字符 s = s.strip() # 去除前后的空格 + s = s.strip('--') if '\'' in s: n = len(s)