小编Nou*_*ra 的帖子

Python删除标签符号并保留关键字

我想删除主题标签符号 ( '#') 和分隔单词 ( '_') 的下划线

例子: "this tweet is example #key1_key2_key3"

我想要的结果: "this tweet is example key1 key2 key3"

我的代码使用字符串:

#Remove punctuation , # Hashtag Symbol 
translate_table = dict((ord(char), None) for char in string.punctuation)   
cleaned_combined_tweets.translate(translate_table)
Run Code Online (Sandbox Code Playgroud)

这给出了结果: "this tweet is example key1key2key3"

python data-cleaning

6
推荐指数
1
解决办法
6670
查看次数

Python3:删除阿拉伯语标点符号

我正在使用阿拉伯语文本,我想删除阿拉伯语标点符号示例:

s="????? ??????? ?? ??? ??????? ! ?????? ???????? ? ,? ?? .???????"
Run Code Online (Sandbox Code Playgroud)

我希望输出" ? ? "也被删除,因为当我使用时:

import string
tr= str.maketrans("","", string.punctuation) 
Run Code Online (Sandbox Code Playgroud)

输出是 '????? ??????? ?? ??? ??????? ?????? ???????? ? ?? ???????'

python unicode python-3.x

4
推荐指数
2
解决办法
2051
查看次数

标签 统计

python ×2

data-cleaning ×1

python-3.x ×1

unicode ×1