API Help

Rob Gaddi rgaddi at highlandtechnology.invalid
Wed Jun 14 19:05:07 EDT 2017


On 06/14/2017 03:49 PM, Grant Edwards wrote:
> On 2017-06-14, Erik <python at lucidity.plus.com> wrote:
>> On 14/06/17 22:54, Ray Cote wrote:
>>> Definitely JSON:
>>>>>>
>>> json.loads(“""[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"KY-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"TX-1-US","quantityAvailable":14.0000000000000},{"warehouseCode":"CA-1-US","quantityAvailable":4.0000000000000},{"warehouseCode":"AB-1-CA","quantityAvailable":1.0000000000000},{"warehouseCode":"WA-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"PO-1-CA","quantityAvailable":0.0000000000000}]}]""")
> [...]
>>
>> If that makes it definitely JSON, then this makes it definitely Python ;) :
>>>>>
>> [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"KY-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"TX-1-US","quantityAvailable":14.0000000000000},{"warehouseCode":"CA-1-US","quantityAvailable":4.0000000000000},{"warehouseCode":"AB-1-CA","quantityAvailable":1.0000000000000},{"warehouseCode":"WA-1-US","quantityAvailable":0.0000000000000},{"warehouseCode":"PO-1-CA","quantityAvailable":0.0000000000000}]}]
> 
> Indeed.
> 
>> So, I think we're agreed that it's definitely one or the other.
> 
> It's both a floor wax _and_ a dessert topping!
> 

Since it's viable directly as Python code, you should just eval() the 
random thing you got from the Internet and use the result.[*]_

.. [*] Don't do that.  Don't ever, EVER do that.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list