Reading from Python dict if key might not be present

后端 未结 7 609
清酒与你
清酒与你 2021-01-30 17:10

I am very new to Python and parsing data.

I can pull an external JSON feed into a Python dictionary and iterate over the dictionary.

for r in results:
         


        
7条回答
  •  轮回少年
    2021-01-30 17:44

    the initial question in this thread is why I wrote the Dictor library, it handles JSON fallback and None values gracefully without needing try/except or If blocks.

    Also gives you additional options like ignore upper/lower case,

    see,

    https://github.com/perfecto25/dictor

提交回复
热议问题