Search and get a line in Python

Posted by omfgroflmao on Stack Overflow See other posts from Stack Overflow or by omfgroflmao
Published on 2010-04-01T02:39:10Z Indexed on 2010/04/01 2:43 UTC
Read the original article Hit count: 769

Filed under:
|
|
|
|

Is there a way to search, from a string, a line containing another string and retrieve the entire line?

For example:

string = 
    qwertyuiop
    asdfghjkl

    zxcvbnm
    token qwerty

    asdfghjklñ

retrieve_line("token") = "token qwerty"

© Stack Overflow or respective owner

Related posts about python

Related posts about line