Getting the previous line in Jython
- by kdev
I want to print the line immediately before the searched string. How can I do that?
Lets say my two lines are
AADRG
SDFJGKDFSDF
and I am searching for SDF. I have found SDFJGKDFSDF, but how can I obtain the previous line AADRG? Does file.readline()-1 work?