我要删除“ pic.twitter.com/zzzzz”之类的网址如何删除它?
我试图删除网址,这是代码
def remove_urls(vTEXT):
vTEXT = re.sub(r'(https|http|pic)?:\/\/(\w|\.|\/|\?|\=|\&|\%)*\b', '', vTEXT, flags=re.MULTILINE)
return(vTEXT)
hihi = remove_urls("this picture is belongs to pic.twitter.com, an te page is https://skype.co.id")
print(hihi)
# the result
this picture is belongs to pic.twitter.com, an te page is
所以,我希望结果是我们所属的这张图片,页面是
答案 0 :(得分:-1)
txt = 'Hello all please help pic.twitter.com/dgfdbf sdde'
' '.join(word for word in txt.split(' ') if not word.startswith('pic.twitter.com/'))