[Tutor] processing a text file w/ OO?

Pujo Aji ajikoe at gmail.com
Mon Jan 23 08:43:11 CET 2006


you can use regex if you want.
It gives you power to do text processing.

OO will give you benefit because your program becomes clearer while it  is
developed

Cheers,
pujo

On 1/23/06, Michael <list at ohtogo.com> wrote:
>
> Hi.
>
> I'm processing a tab-delimited text file where I read in a file,
> perform a bunch of operations on the items, and then write them out
> again to a fixed-width text file.
>
> I've been doing this with a very functional approach:
>
> - loop over lines
> - read line into dictionary
> - process dictionary values ( format phone numbers and dates and
> amounts, etc.)
> - pad dictionary values with spaces
> - write dictionary values out to file
>
> Anyway, this all works fine. Not knowing much about OO, I'm wondering
> if there's a way to approach this from an object-oriented
> perspective. Is there anything to be gained? Or is this type of
> problem best tackled with a functional approach?
>
> TIA.
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060123/fccca3c6/attachment.html 


More information about the Tutor mailing list