Rounding off Values of dicts (in a list) to 2 decimal points
Neil Cerutti
neilc at norwich.edu
Thu Oct 3 14:03:17 EDT 2013
On 2013-10-03, tripsvt at gmail.com <tripsvt at gmail.com> wrote:
> thekey=[{"a": 80.0, "b": 0.0, "c": 10.0, "d": 10.0}, {"a":
> 100.0, "b": 0.0, "c": 0.0, "d": 0.0}, {"a": 80.0, "b": 0.0,
> "c": 10.0, "d": 10.0}, {"a": 90.0, "b": 0.0, "c": 0.0, "d":
> 10.0}]
>
> However, at the URL, the values show up as 90.000043278694123
You'll need to convert them to strings yourself before submitting
them, by using % formatting or str.format.
--
Neil Cerutti
More information about the Python-list
mailing list