Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如果存在类似“tweet”的URL,如何删除tweet中的URL;pic.twitter.com“;_Python 3.x - Fatal编程技术网

Python 3.x 如果存在类似“tweet”的URL,如何删除tweet中的URL;pic.twitter.com“;

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

我想删除像“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.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/'))