osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Casting to a "number" (both int and float)?


Ben Finney writes:

> Victor Hooi writes:
>
>> Many of the fields are meant to be numerical, however, some fields are
>> wrapped in a "floatApprox" dict, which messed with my parsing.
>
> The examples you give of ?floatApprox? are not dicts, so I'm not sure
> quite what that means.

I took the distinction to be between 123123 and {"floatApprox":
213123123}. The former looks like an int, the latter like a dict.

>>     "network": {
>>         "bytesIn": 123123,
>>         "bytesOut": {
>>             "floatApprox": 213123123
>>         }

> What do you mean by ?wrapping??

I read it so that the bytesOut value, 213123123, is "wrapped" in
{"floatApprox": }, and Victor wants just the number inside.

[- -]