[Tutor] How to parse InputFile to generate OutputFile?
alan.gauld at btinternet.com
Thu Sep 18 02:35:18 CEST 2008
"Kamisetty, Rajendra" <rkamisetty at paypal.com> wrote
> I am new to Python and need your help
It will help if you start a new thread by posting a new message rather
than replying to an existing one and changing the subject. Those of
us with threaded readers don;t see your post because it is hidden
inside the original thread!
> I need to generate an output text file based on the input text file
> Input.txt contents:
> ('844 - Open File Message',
> '011 - System Trace Audit Number: 823301',
> '012 - Local Time: 033543',
> '013 - Local Date: 0821',
> '024 - Function
> Code: 861')
> Output.txt contents:
> ( which has fixed length format of 142 bytes each line.)
> 11 00000000000030004 050908024536000674000000
> 23 0000000000003000400828000113105470509080245364247939
I'm strugglibng to see the correlation here. The second line does not
look like the same length as the first - unless the first is full of
> 1. Parse the input file to get the value (bold) appears next to
> "System Trace Audit Number2".
> 2. Replace the value (bold) with database equivalent eg.
> 3. Generate the output file as below where everything is constant
> bold text which is databse equivalent of parsed value from input
Tell us which step puzzles you and why.
We wilol try to help. At the moment we can't tell what exactly you
need help with?
Author of the Learn to Program web site
More information about the Tutor