Posted By

magicrebirth on 06/10/11


Tagged

url parse search String re


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

navi4all


Extracting a URL in Python


 / Published in: Python
 

URL: http://stackoverflow.com/questions/839994/extracting-a-url-in-python

  1. import re
  2.  
  3. myString = "This is my tweet check it out http://tinyurl.com/blah"
  4.  
  5. print re.search("(?P<url>https?://[^\s]+)", myString).group("url")

Report this snippet  

You need to login to post a comment.