#!/usr/bin/env python## find all URL's and return them# regex from http://gnosis.cx/TPiP/import relinks = []f = file('logovi','r').read()pat = r''' (?x)( # verbose identify URLs within text(http|https|ftp|gopher) # make sure we find a resource type :// # ...needs to be followed by colon-slash-slash [^ \n\r]+ # some stuff then space, newline, tab is URL \w # URL always ends in alphanumeric char (?=[\s\.,]) # assert: followed by whitespace/period/comma ) # end of match group'''links = re.findall(pat, f)for url in links: print url[0]