Text file extract

Andy Hoosbruin at Kconline.com
Thu Sep 4 19:06:36 EDT 2003


I have a test file and need to split the data based upon a record in a
certain field. Then write those record to a multiple files in different
folders.



 Example data:

RECORD 1)  ABCD,666,TOM,4.00,9/1/03
RECORD 2)  TYTY,666,TIM,4.00,9/1/03
RECORD 3)  ABCD,666,BILL,4.00,9/1/03
RECORD 4)  XXXX,666,TOM,4.00,9/1/03


All the fields will be comma separated and the 3rd field will contain the
record I will use to split.

 So records 1 and 4 get written to the same file call it Cust.txt and write
it to folder \\server\tom\Cust.txt
 Then record 2  gets written to cust.txt in a different folder
\\server\tim\cust.txt


  and so on.....

 I have never written a Python script so would like to see how this would be
done. I deal with a lot of text file input and would like to see how easy
Python handles this task..

 thanks in advance... If you could doc some of your code so I can follow
thru it .. would be great.

















More information about the Python-list mailing list