chopping csv-files (newbie)

Mikael Lexén mikael.lexen at stop.spam.volvo.com
Thu Apr 18 07:37:45 EDT 2002


Hi

I get the following when I try to import your module

PythonWin 2.1.3 (#35, Apr  8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (mhammond at skippinet.com.au) - see
'Help/About PythonWin' for further copyright information.
>>> import csv
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
ImportError: DLL load failed with error code 193

What's wrong? I'am on NT4.

/Mikael

Dave Cole wrote:

> > I have a csv-file.. delimited by ;
> > example-line from the csv-file
> > "90383";"ooooxWOW   90383;";"Some discription";
> > "99875";"ooooxSomede90383;0000xNewli99875;";"New line-descriptor";
> >
> > In this file there is 3 fields extracted from a database.
> > The second field, can vary som 1 to 4 fields separated by ; but not with
> > "
> >
> > What I need to do is to build an array after opening a given file
> > with the information from the second and third fields.
> >
> > E.g:
> >
> > 90383 Some discription
> > 99875 New line-descriptor, Some discription
> >
> > You see where I'm going at?
> >
> > the second record in this file has a reference to the first record in
> > its second field.
>
> You could use my CSV parser:
>
> >>> import csv
> >>> p = csv.parser()
> >>> p.field_sep = ';'
> >>> p.parse('"90383";"ooooxWOW   90383;";"Some discription";')
> ['90383', 'ooooxWOW   90383;', 'Some discription', '']
> >>> p.parse('"99875";"ooooxSomede90383;0000xNewli99875;";"New line-descriptor";')
> ['99875', 'ooooxSomede90383;0000xNewli99875;', 'New line-descriptor', '']
>
> The module is available at:
>
>         http://www.object-craft.com.au/projects/csv/
>
> - Dave
>
> --
> http://www.object-craft.com.au

--
/Mikael

_________________________________________________
Mikael Lexén
Volvo Information Technology AB
Dept 9514, HD2N
SE-405 08 Göteborg, Sweden

Telephone: +46 31 3215757
E-mail: mikael.lexen at volvo.com





More information about the Python-list mailing list