[Tutor] one more question on a word in a specific place in a line

Tony Cervone tcervone@excellmfg.com
Sat, 20 Oct 2001 07:26:57 -0400


Thanks you very much, gentlemen. This is the greatest bunch of folks for
someone who wants to learn Python. 
I am making very good progress on my problem. So here's a continuation of
it:

I am currently reading a text file that is essentially a weather report. It
looks as follows:

12-23-01
KPVD yyyyyy/ggggg/kkkkkkk/lllllllllll

12-23-01
KLGAyyyyyy/ggggggg/kkkkkkkk

I am using the readlines() and the line.split commands to print the "first
word" in the second line, and the "first word" in the 4 line. My code works
well if the text always looks like the above example. Sometimes, however, a
different weather text may have some additional text that spills into the
next line. For example
12-23-01
KPVD yyyyyy/ggggg/kkkkkkk/lllllllllll
ZZZZ

12-23-01
KLGAyyyyyy/ggggggg/kkkkkkkk

If this happens, the "first" word in the 4 line  clearly will not be the
same. My code will read and print 12-23-01 instead of KLGA.
How do I do it so that in both cases the print out will be KPVD KLGA , and
not KPVD 12-23-01