[Tutor] How to parse InputFile to generate OutputFile?
Alan Gauld
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
> data
> 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')
> etc/...
> Output.txt contents:
> ( which has fixed length format of 142 bytes each line.)
> 11 00000000000030004 050908024536000674000000
> 13
>
> 23 0000000000003000400828000113105470509080245364247939
> 000000070824800000005090805008585147778978978050908050908
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
spaces?
> 1. Parse the input file to get the value (bold) appears next to
> string
> "System Trace Audit Number2".
> 2. Replace the value (bold) with database equivalent eg.
> 369325=092222257UXT
> 3. Generate the output file as below where everything is constant
> except
> bold text which is databse equivalent of parsed value from input
> file.
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?
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list