Is there a way to search, from a string, a line containing another string and retrieve the entire line?
For example:
string = qwertyuiop asdfghj
With regular expressions
import re s=""" qwertyuiop asdfghjkl zxcvbnm token qwerty asdfghjklñ """ >>> items=re.findall("token.*$",s,re.MULTILINE) >>> for x in items: ... print x ... token qwerty