Python Forum
Error while checking for key in Dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while checking for key in Dictionary
#6
(Aug-14-2020, 11:42 AM)ndc85430 Wrote:
(Aug-13-2020, 05:20 PM)onenessboy Wrote:
    status = json.loads(response.text)
    items = status.items()
    tags = items['value']['tags']
    print(tags)

One question to help you work it out: what type is items? Perhaps you should print it out if you're not sure.

Yeah tried with
print(type(items))
it returned class dict

I even tried this

tags = items['value']['tags']
replaced with
tags = get('tags')

then it returned
Nonetype error
Reply


Messages In This Thread
RE: Error while checking for key in Dictionary - by onenessboy - Aug-14-2020, 01:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Proxy Checking Software Error rizzla 5 2,530 Jan-19-2021, 09:40 AM
Last Post: rizzla
  Iterating over a dictionary in a for loop - checking code has worked sallyjc81 1 1,885 Dec-29-2020, 05:14 PM
Last Post: ndc85430
  Is it possible to check for a key error in a python dictionary? mrsenorchuck 0 1,438 Dec-06-2019, 11:38 PM
Last Post: mrsenorchuck
  Checking if the combination of two keys is in a dictionary? mrsenorchuck 6 3,780 Dec-04-2019, 10:35 AM
Last Post: mrsenorchuck
  Calculation Inside Dictionary Error prophet11 3 2,558 Apr-22-2019, 05:23 AM
Last Post: perfringo
  Dictionary Results Error prophet11 2 2,239 Apr-21-2019, 11:22 PM
Last Post: prophet11
  Error 'object has no attribute' when iterating thru a dictionary mrapple2020 8 6,876 Apr-08-2019, 01:36 AM
Last Post: mrapple2020

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020