Python 3.x 如果存在类似“tweet”的URL,如何删除tweet中的URL;pic.twitter.com“;
我想删除像“pic.twitter.com/zzzzz”这样的url如何删除它 我已经尝试删除URL,这是代码Python 3.x 如果存在类似“tweet”的URL,如何删除tweet中的URL;pic.twitter.com“;,python-3.x,Python 3.x,我想删除像“pic.twitter.com/zzzzz”这样的url如何删除它 我已经尝试删除URL,这是代码 def删除URL(vTEXT): vTEXT=re.sub(r'(https | http | pic):\/\/(\w |\.\124;\/\?\ 124\=\\\&\\%)*\ b','',vTEXT,flags=re.MULTILINE) 返回(vTEXT) hihi=remove_url(“此图片属于pic.twitter.com,te页面为https://skype.co.i
def删除URL(vTEXT):
vTEXT=re.sub(r'(https | http | pic):\/\/(\w |\.\124;\/\?\ 124\=\\\&\\%)*\ b','',vTEXT,flags=re.MULTILINE)
返回(vTEXT)
hihi=remove_url(“此图片属于pic.twitter.com,te页面为https://skype.co.id")
打印(hihi)
#结果
这张照片是属于pic.twitter.com的,一个te页面是
因此,我希望结果是这张图片属于我们,页面是这只会删除
pic.twitter.com/
,而不会删除其他链接。
txt = 'Hello all please help pic.twitter.com/dgfdbf sdde'
' '.join(word for word in txt.split(' ') if not word.startswith('pic.twitter.com/'))