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

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -