ASCII delimited files

Thomas A. Bryan tbryan at python.net
Thu Nov 11 03:20:49 CET 1999


"Thomas A. Bryan" wrote:

> class DelimParserField:
>     def __init__(self, name):
>         self.name = name
>     def convert(self,value):
>         return value
>     def verify(self,value):
>         pass
> 

One important thing that I didn't point out.  The "name" member 
is the column's name.  (Remember that I was thinking of 
delimited files for import into a database when I wrote these 
classes.)

Thus, a more sensible application might have something like
employeeListParser = DelimFldParser((EnumField('Department',('HR','IT')),
                                     DelimParserField('Name'),
                                     NumericRngField('Salary',0,500000)))

If anyone uses this stuff, I'd be interested in hearing about it.

---Tom




More information about the Python-list mailing list