Compare commits
7 Commits
Bug492-XuH
...
master
Author | SHA1 | Date |
---|---|---|
丁晟晔 | ff6286cf01 | |
丁晟晔 | 1d7e61d751 | |
顾涵 | 708a6a2821 | |
顾涵 | 688a198768 | |
顾涵 | 030b89706e | |
顾涵 | acd8db6e3e | |
顾涵 | 9f3f5b43e1 |
|
@ -39,7 +39,7 @@ def file2str(fname):#文件转字符
|
||||||
|
|
||||||
|
|
||||||
def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用时才给s赋值。
|
def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用时才给s赋值。
|
||||||
special_characters = '\_©~<=>+-/[]*&$%^@.,?!:;#()"“”—‘’{}|' # 把里面的字符都去掉
|
special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|' # 把里面的字符都去掉
|
||||||
for c in special_characters:
|
for c in special_characters:
|
||||||
s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况
|
s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况
|
||||||
s = s.replace('--', ' ')
|
s = s.replace('--', ' ')
|
||||||
|
|
Loading…
Reference in New Issue