Python 3 error typeerror: ‘dict’_ keys‘ object is not subscriptable

 

Problem: using in Python encoding dict.keys (), typeerror: ‘dict’ will be reported_ Keys’ object is not subscriptable

 

Solution: you need to use list in Python 3, as shown in the figure

 

Reason: Dict_ Keys ([‘No surfacing ‘,’flippers’]) returns a dict_ The keys object is no longer of the list type and does not support index

Therefore, the list type can be used

 

If there is any omission in my statement, please don’t hesitate to give me advice. Thank you very much!
If you think it’s useful, please praise it, creative power!

Read More: