Python Forum
call dict object result key error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
call dict object result key error
#1
hello, my program include a dict, but when I try to call a object of the dict, that result with a KeyEror
actualsearch=0
dict={ 0: 41, 1: 41, 2: 41, }

if dict[int(actualsearch)]==41: #I try int and str, but both dosen't work
    do something
    actualsearch=actualsearch+1
I want to call the dict object whit the var actualsearch, but they call this error
Error:
if dict[int(actualsearch)]==41: KeyError: '0'
if you can help my, I will be thankful
Reply


Messages In This Thread
call dict object result key error - by lateublegende - May-14-2019, 04:52 PM
RE: call dict object result key error - by buran - May-14-2019, 05:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  This result object does not return rows. It has been closed automatically dawid294 5 5,563 Jan-10-2024, 10:55 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 2,276 Jul-23-2023, 02:25 PM
Last Post: Fare
  Error in Int object is not subscript-able. kakut 2 1,936 Jul-06-2022, 08:31 AM
Last Post: ibreeden
  'int' object is not subscriptable after API call ed8484 1 2,617 Sep-18-2021, 02:06 PM
Last Post: ed8484
Star Type Error: 'in' object is not callable nman52 3 4,592 May-01-2021, 11:03 PM
Last Post: nman52
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 error from Mysql call AkaAndrew123 1 4,381 Apr-28-2021, 08:16 AM
Last Post: AkaAndrew123
  how to call an object in another function in Maya bstout 0 2,697 Apr-05-2021, 07:12 PM
Last Post: bstout
  In this function y initially has no value, but a call to foo() gives no error. Why? Pedroski55 8 5,005 Dec-19-2020, 07:30 AM
Last Post: ndc85430
  Error in Int object is not subscript-able. How to debug this ? yanDvator 1 2,832 Aug-03-2020, 02:28 PM
Last Post: Larz60+
  Python: Call function with variabele? Ending in error. efclem 5 4,137 Apr-22-2020, 02:35 PM
Last Post: buran

Forum Jump:

User Panel Messages

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