我想从我的推特删除超链接 例如: 我曾说过:“改革医疗保健服务于病人,而不是企业医疗 http://t.co/WMKJKU4hl7@PNHP#单一付款人星期日http://t.co/i4bNrruUNS” 但我想得到的是:“改革医疗保健服务病人,而不是企业医疗” 怎么可能呢? 谢谢你!在
根据这些建议,我重写了我所有tweet列表的代码。我写了一个for循环,但没用:
我试过这个,因为我有一个tweets列表,但是没有为
for i in range(len(cleandata)):
finaldata=[]
if 'http://' in cleandata[i]:
post = cleandata[i]
position = post.index('http://')
finaldata.append(post[:position])
else:
finaldata.append(cleandata[i])
cleandata是我的tweet列表
你们知道吗?在
您可以找到
http://
所在的位置,然后将其切片。在结果
^{pr2}$哦,很小的错误。。。我纠正了。。。谢谢各位!在
您可以尝试使用
re
相关问题 更多 >
编程相关推荐