Hi Kent,
thanks for the valuable suggestion. to make it more clearer
here is my example...
Below is my input text file in dlg format. this dlg file contains 2
information.
one is for coordinate x=50, y=55 and another is for coordinate x=60, y=65.
*****************************************************************
Machine No.: ABC Date: March 03,2006 11:22AM
Program Name: DEF
Version: B0 Lot: GHI
Operator: Jane
Item 0.A00.000.001 print_x_y_coordinate
0.A00.***.*** print_x_y_coordinate
=====================================================================================
0.A00.***.*** print_x_y_coordinate >>>>>
50,55
0.A00.***.*** print_x_y_coordinate
=====================================================================================
0.A00.***.*** print_x_y_coordinate
Item 5004.A00.000.001 current_item
5004.A00.***.*** current_item A
5004.A00.***.*** current_item -16.737uA,
5004.A00.***.*** current_item
5004.A00.***.*** current_item description:, 50, 55,0, 16,16.737
400.A00.***.*** curr_log_item
curr:,x_coor,y_coor,v3d3,v1d8,curr1,curr2,curr3,curr4,curr5,curr6
400.A00.***.*** curr_log_curr curr:, 50, 55,2.9,1.5, 18.00760,
17.84030, 18.06844, 0.10003, 0.06925, -0.00769
400.A00.***.*** curr_log_item curr:, 50, 55,3.3,1.8, 21.52091,
21.64259, 21.68821, -0.00769, 0.08464, 0.00769
400.A00.***.*** curr_log_item curr:, 50, 55,3.7,2.1, 24.42586,
24.48669, 24.50190, 0.02308, -0.06925, -0.14620
Item 0.A00.000.001 get_time_item
0.A00.***.*** get_time_item Time:, 50, 55,47.733332s
b00 Result=OK, Number=2
Machine No.: ABC Date: March 03,2006 11:24AM
Program Name: DEF
Version: B0 Lot: GHI
Operator: Jane
Item 0.A00.000.001 print_x_y_coordinate
0.A00.***.*** print_x_y_coordinate
=====================================================================================
0.A00.***.*** print_x_y_coordinate >>>>>
60,65
0.A00.***.*** print_x_y_coordinate
=====================================================================================
0.A00.***.*** print_x_y_coordinate
Item 5004.A00.000.001 current_item
5004.A00.***.*** current_item A
5004.A00.***.*** current_item -25.737uA,
5004.A00.***.*** current_item
5004.A00.***.*** current_item description:, 60, 65,1, 16,25.737
400.A00.***.*** curr_log_item
curr:,x_coor,y_coor,v3d3,v1d8,curr1,curr2,curr3,curr4,curr5,curr6
400.A00.***.*** curr_log_curr curr:, 60, 65,2.9,1.5, 19.00760,
18.84030, 19.06844, 0.20003, 0.16925, -0.10769
400.A00.***.*** curr_log_item curr:, 60, 65,3.3,1.8, 22.52091,
22.64259, 22.68821, -0.10769, 0.18464, 0.10769
400.A00.***.*** curr_log_item curr:, 60, 65,3.7,2.1, 25.42586,
25.48669, 25.50190, 0.12308, -0.16925, -0.24620
Item 0.A00.000.001 get_time_item
0.A00.***.*** get_time_item Time:, 60, 65,57.444455s
b00 Result=OK, Number=3
*******************************************************************************************************************************************************************
the output file below in csv excel format
********************************************************************************************************************************************************************************************************************
Machine No. Lot Date Time X
Y current item curr1_2.9_1.5 curr2_2.9_1.5 curr5_2.9_1.5
curr3_3.7_2.1 curr5_3.7_2.1 Time Number
ABC GHI March 03, 2006 11:22AM 50 55
16.737 18.00760 17.84030 0.06925
24.50190 -0.06925 47.733332s 2
ABC GHI March 03, 2006 11:24AM 60 65
25.737 19.00760 18.84030 0.16925
25.50190 -0.16925 57.444455s 3
**********************************************************************************************************************************************************************************************************************
if my explanation is not so clear let me know. thanks.
best regards,
Gilbert
On Wed, Nov 26, 2008 at 10:43 AM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 25, 2008 at 6:16 PM, Gilbert <[EMAIL PROTECTED]> wrote:
> > Hi People,
> >
> > I tried to look for some answers but I see only same data format
> > processing ( *.txt to *.txt ) in python.
> > my question is how to convert a text file ( e.g. *.log, *.dlg ) to excel
> > *.csv using python programming.
>
> This kind of program can be pretty simple, depending on the format of
> your text file. It generally will have the form
> open input file
> open output file
> open csv writer for output file
>
> for each line in input:
> split the line into fields
> write the fields to the csv writer
>
> close input file
> close output file
>
>
> The real program may not be much longer than that. I really depends on
> what you need to do with the input lines. Can you show an example?
>
> Kent
>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor