1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Python 去除字符串中的中英文标点符号

Python 去除字符串中的中英文标点符号

时间:2019-07-21 15:16:35

相关推荐

Python 去除字符串中的中英文标点符号

# 去除英文标点符号import stringtest = 'today is friday, so happy..!!!'punctuation_en = string.punctuation # punctuation: 标点符号for i in punctuation_en:test = test.replace(i, '')# 去除中文标点符号, 需要提前按照zhon包 from zhon.hanzi import punctuationtest = '今天周五,下班了,好开心呀!!'for i in punctuation:test = test.replace(i, '')

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。