In <[email protected]> Miki Tebeka
<[email protected]> writes:
> >> I'm trying to find a way to have json emit float('NaN') as 'N/A'.
> > No. There is no way to represent NaN in JSON. It's simply not part of the
> > specification.
> I know that. I'm trying to emit the *string* 'N/A' for every NaN.
import math
x = possibly_NaN()
if math.isnan(x):
x = 'N/A'
--
John Gordon A is for Amy, who fell down the stairs
[email protected] B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list