[How to Solve] ‘dict’ object has no attribute ‘has_key’

When the code is changed from python2.7 to python3.5, the dict data type reports an error

Cause: dict.has_key() ; This method is removed in Python 3

Solution: use

if key in dict : Change to if dict.has_key(key):  

Similar Posts: