On Thu, Apr 22, 2010 at 8:03 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: > It might be a stupid question, but have you tried passing in the > Decimal() object itself?
MRAB's suggestion works for me in python 3.1.2: import csv, io from decimal import Decimal d = Decimal("10.00") o = io.StringIO() w = csv.writer(o, quoting=csv.QUOTE_NONNUMERIC) w.writerow([10, 10.00, d, "10"]) print(o.getvalue()) >>> 10,10.0,10.00,"10" That's an int, a float, a Decimal and a string, all of which appear to be formatted as I would expect. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list