Quck question

J sinzcere at hotmail.com
Tue Jan 6 01:10:21 CET 2004


I have the following information in a file :
r1kcch    Serial0/0/0    propPointToPointSerial
Mon Jan 5 13:15:03 PST 2004 InOctets.1    0
Mon Jan 5 13:15:05 PST 2004 OutOctets.1   0

I want to be able to extract each line into a comma delimited list. 
Bellow i am trying to print out my list print currentList but nothing
is comming out.  I added a line after print test to make sure the file
has the information.  Can someone help me with this?


#Read a file
true = 1
in_file = open("test.txt","r")
text = in_file.read()
while true:
    in_line = in_file.readline()
    if in_line == "":
        break
    currentList = string.split(in_line,",")
    #print out the contents of the current list
    print currentList 
    #make the inline stop reading
    in_line = in_line[:-1]
in_file.close()



More information about the Python-list mailing list