csv blank fields

norseman norseman at hughes.net
Tue Jun 30 21:08:44 EDT 2009


Mag Gam wrote:
> I am using the csv package to parse a compressed .csv.gz file. So far
> its working perfectly fine but it fails when I have a missing value in
> on of the fields.
> 
> For example, I have this
> 
> Abc,def,,jkl
> 
> Is it possible to fill the missing column with a null?
> 
> I want,
> Abc,def,NULL,jkl
> 
> TIA
========================
Ideally you need to test each field for a zero length and put at least a 
single space in any that are BEFORE porting to another format.

If you are going to a fixed field format (SDF) then place that field's 
width spaces into the SDF field.

In any case, DO NOT USE NULLS! There are many programs that will crash 
on them.


HTH

Steve



More information about the Python-list mailing list