[Tutor] Need some concepts re reading in lines of data

Robin B. Lake rbl@hal.cwru.edu
Tue, 21 Mar 2000 17:06:27 -0500 (EST)


The following code (spaces, not tabs) does not print out the "line"
data:

#  Read the input file into a list of line-strings:
        for line in fp.readlines():
                print line
        #       Get the line-per-string into a list of words:
                if len(line) != 0:
                    words = string.split(line)  # line is a string; words is a list of strings
                    print "words=", words

but DOES print out the words data.

What subtle aspect of Python have I missed, please?

Thanks,
Rob Lake
rbl@hal.cwru.edu