我想删除句子中的所有URL。
这是我的代码:
import ijson
f = open("/content/drive/My Drive/PTT ç¬è²/content/MakeUp/PTT_MakeUp_content_0_1000.json")
objects = ijson.items(f, 'item')
for obj in list(objects):
article = obj['content']
ret = re.findall("http[s*]:[a-zA-Z0-9_.+-/#~]+ ", article) # question here
for r in ret:
article = article.replace(r, "")
print(article)
但是“http”的url仍然留在句子中。
article_example = "ç¼å½±ç¤é·é樣 http://i.imgur.com/uxvRo3h.jpg 說çç å¾ä¸å¥½æ"
知道吗?
谢谢你的帮助。