CSV and number formats

Frank Millman frank at chagford.com
Sun Feb 1 01:45:54 EST 2015


Hi all

I downloaded some bank statements in CSV format with a view to providing an 
automated bank reconciliation feature for my accounting software.

One of them shows the opening balance in an unusual format.

Most transaction amounts are in the format '-00000031.23' or '+00000024.58'

This can easily be parsed using decimal.Decimal().

If the opening balance is positive, it appears as '+00000021.45'

If it is negative, it appears as '+00000-21.45'

Predictably, decimal.Decimal does not like this.

Is this a recognised format, and is there a standard way of parsing it? If 
not, I will have to special-case it, but I would prefer to avoid that if 
possible.

Thanks

Frank Millman






More information about the Python-list mailing list