Q:

how to parse text

i have a question that i want to read a file, search for any line that has session ID (e.i.  12345), if matched then print all lines after that until encounter newline. 
after that, how can i associate all these lines to the session ID if i need to further parse these lines. 
And i want to do it in Python. 
Thanks

A:

this answers the first part of your question:
with open('myfile.txt') as f:
    for line in f:
        if '12456' in line:
            print line

I didn't understand what else you were asking for.   can you translate : "how can i associate all these lines to the session ID if i need to further parse these lines"?