Environment:
Python3.6.5
Issues:
When I was using Django, there is an error appear:
‘dict’ object has no attribute ‘has_key’
Here is my code:
Reason:
There has_key() method has been deleted since python3.
Solution:
Modify:
if dict.has_key(key1):
to
if key1 in adict:
as following:
Done!
Read More:
- How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’
- [Solved] TUM associate.py Scripte Error: AttributeError: ‘dict_keys‘ object has no attribute ‘remove‘
- Python 3.7 Error: AttributeError: ‘str‘ object has no attribute ‘decode‘ [How to Solve]
- How to Solve Python AttributeError: ‘module’ object has no attribute ‘xxx’
- [Modified] AttributeError: ‘socket‘ object has no attribute ‘ioctl‘ python linux
- [Solved] PyQt: RuntimeError: wrapped C/C++ object has been deleted & has no attribute of flush in python
- [Solved] Selenium python send_key error: list object has no attribute
- [2021-10-05] Python Error: AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Solved] Python Keras Error: AttributeError: ‘Sequential‘ object has no attribute ‘predict_classes‘
- Python Openyxl Error: AttributeError: ‘int‘ object has no attribute ‘upper‘ [How to Solve]
- [Solved] Python Selenium Error: AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_xpath‘
- [Solved] python Error: AttributeError: ‘NoneType‘ object has no attribute ‘split‘
- Python writes DICOM file (attributeerror: ‘filemetadataset’ object has no attribute ‘transfersyntax uid’ solution)
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- [Solved] AttributeError: ‘PngImageFile‘ object has no attribute ‘imshow‘
- [Solved] AttributeError: ‘DataParallel‘ object has no attribute ‘save‘
- [Solved] Pycharm error: attributeerror: ‘Htmlparser’ object has no attribute ‘unescape’
- [Solved] AttributeError: ‘_IncompatibleKeys’ object has no attribute
- Djangorestframework-simplejwt: ‘str‘ object has no attribute ‘decode‘ [Solved]
- [Solved] AttributeError: ‘Manager‘ object has no attribute ‘get_by_natural_key‘