Quck question

Tim Heaney theaney at cablespeed.com
Mon Jan 5 20:08:06 EST 2004


sinzcere at hotmail.com (J) writes:

> 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?

I'm not certain I understand what you're doing, but perhaps you want
something like this?

  file = open("test.txt")
  for line in file:
      list = line.split()
      if len(list):
          print ','.join(list)

I hope this helps,

Tim



More information about the Python-list mailing list