Getting the previous line in Jython
Posted
by kdev
on Stack Overflow
See other posts from Stack Overflow
or by kdev
Published on 2010-03-24T14:09:54Z
Indexed on
2010/03/24
15:33 UTC
Read the original article
Hit count: 267
python
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?
© Stack Overflow or respective owner