Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KeyError: 2
#5
According to your print row is a dictioany, not a list. You can use row["id"] or row["date"] or row["product1"]. You cannot do row[2] or row[3]. Maybe that should be row["product2"] and row["product3].

Why do you do this "print("{0}".format(row[2]))" when it does the exact same thing as "print(row[2])"?
Reply


Messages In This Thread
KeyError: 2 - by stsxbel - Aug-16-2022, 04:15 PM
RE: KeyError: 2 - by deanhystad - Aug-16-2022, 05:16 PM
RE: KeyError: 2 - by ibreeden - Aug-16-2022, 05:17 PM
RE: KeyError: 2 - by stsxbel - Aug-16-2022, 05:34 PM
RE: KeyError: 2 - by deanhystad - Aug-16-2022, 05:48 PM
RE: KeyError: 2 - by stsxbel - Aug-16-2022, 05:55 PM
RE: KeyError: 2 - by stsxbel - Aug-16-2022, 06:05 PM
RE: KeyError: 2 - by deanhystad - Aug-16-2022, 06:27 PM
RE: KeyError: 2 - by stsxbel - Aug-16-2022, 06:29 PM

Forum Jump:

User Panel Messages

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