python remove http hyperlink -



python remove http hyperlink -

i remove hyperlinks tweets instance: have: "reform health care serve patients, not corporate medicine http://t.co/wmkjku4hl7 @pnhp #singlepayersunday http://t.co/i4bnrruuns" want get:"reform health care serve patients, not corporate medicine" how possible? ahead!

upon suggestions, rewrite code whole list of tweets. wrote loop, did not work:

i tried one, because have list of tweets., did not work

for 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 list guys have idea?

you can find position http:// , , piece it.

post = "reform health care serve patients, not corporate medicine http://t.co/wmkjku4hl7 @pnhp #singlepayersunday http://t.co/i4bnrruuns" position = post.index('http://') print post[:position]

result

reform health care serve patients, not corporate medicine

python http loops for-loop

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -