def remove_rows(dic, del_index):
for i in del_index:
for j in dic.items():
What I expected to happen:
I expect to get solution
What actually happened:
"Executing the function remove_rows caused an error: TypeError: 'dict_items' object is not subscriptable."
You get that error because the
 part of
dic.items() is incorrect.
Let’s say you have the following -
a = [1, 2, 3]
a is a list, as you know. The variable
a is an object of type
dic.items() is an object of type
In Python, you can index a
list such as
a, but you can’t index
dict_items. Therefore, your code of
dic.items() throws that error. It’s not a valid operation in Python.
So, you will have to use an alternative approach tot accomplish whatever you were trying to do.