AttributeError: 'dict' object has no attribute 'has_key'
2017-11-01 18:34
1516 查看
AttributeError: ‘dict’ object has no attribute ‘has_key’
Python 3 已弃用
错误代码:
修正后:
参考:
What’s New In Python 3.0
‘dict’ object has no attribute ‘has_key’
Python 3 已弃用
has_key这一方法
错误代码:
ssCnt = {} if not ssCnt.has_key(can): ssCnt[can]=1 else: ssCnt[can] += 1
修正后:
ssCnt = {} if can not in ssCnt: ssCnt[can]=1 else: ssCnt[can] += 1
参考:
What’s New In Python 3.0
‘dict’ object has no attribute ‘has_key’
相关文章推荐
- ‘dict’ object has no attribute 'has_key'解决办法
- AttributeError: 'dict' object has no attribute 'interitems'
- ‘dict’ object has no attribute 'has_key'
- 'dict' object has no attribute 'has_key'
- AttributeError: 'dict' object has no attribute 'iteritems'
- AttributeError: 'dict' object has no attribute 'iteritems'
- AttributeError: ‘module’ object has no attribute ‘load_dotenv
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: ‘module’ object has no attribute’xxx 问题解决
- 使用vectorizer.fit_transform时出现AttributeError: 'file' object has no attribute 'lower'
- AttributeError: 'module' object has no attribute 'XXX'
- AttributeError: 'dict' object has no attribute 'iteritems'
- AttributeError: 'dict' object has no attribute 'iteritems'
- 'dict' object has no attribute 'resolve'
- AttributeError: 'module' object has no attribute 'reader'
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute 'best_partition'
- AttributeError: 'module' object has no attribute 'LabelMap'
- AttributeError: 'module' object has no attribute 'urlopen'
- Python3下AttributeError: 'dict' object has no attribute 'iteritems'的问题分析