[Tutor] Can i define anywhere on file object function for reading a range of lines?

kumar s ps_python at yahoo.com
Sun Dec 5 14:11:21 CET 2004


Dear group, 
 
For instance I have a text  that looks like following:

Segment:Page 21
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
.............................
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Segment:Page 22
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
............................

Segment:Page 23
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
............................
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

I have another file with Page numbers that looks like
this:

Page 1
Page 2
......
Page 22
Page 34
Page 200

I can see that Page 22 is existing in my first file.
Now I am trying locate Page 22 segment in first file
and asking my program to read STARTING from
Segment:Page 22 to End of page 22 segment that is a
blank line(empty line)  OR Start of another segment
which Segment: Page 23. 

Question: 
Is there any function where I can specify to python
buit-in function to select specific line (such as
starting from segment: page 22 TO the next new line)
instead of the whole lines until EOF. 
e.g.:
a = readlines (From , TO )

I asked a similar question before and that was well
taught by experts, however, I am still confused. Can
any one please help me again. 
Thank you. 

Kumar




		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 


More information about the Tutor mailing list