text = urllib.ur开发者_Go百科lopen('www.text.com').read()
frase = re.search("your text here(.*)", text).group()
With these code, I get the result as "your text here mister"...
How can I remove the your text here from the result, staying only with the "mister" part?
Specify the number of the group (= thing between parenthesis in the regex) you want to receive in the call to group()
:
frase = re.search(...).group(1)
don't need regex
text = urllib.urlopen('www.text.com').read()
print ''.join( text.split("your text here")[1:] )
精彩评论