AttributeError: 'dict' object has no attribute 'has_key'
See original GitHub issueI use anaconda with python3.5 and tensorflow 1.2 in win10. Running the example codes:
python main.py --dataset ptb
and
python main.py --dataset ptb --forward_only_True
both give the same error message.
Traceback shows there may be something wrong with:
if not word2idx.has_key(word):
in batch_loader.py (line 144)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
'dict' object has no attribute 'has_key' - python - Stack Overflow
has_key was removed in Python 3. From the documentation: Removed dict.has_key() – use the in operator instead. Here's an example:
Read more >Attributeerror: dict object has no attribute has_key ( Solution )
Attributeerror: dict object has no attribute has_key error occurs because has_key() function is deprecated syntax in python 3. But do not worry, ...
Read more >Attributeerror: dict object has no attribute has_key ( Solved )
The solution of the attributeerror: dict object has no attribute has_key is very simple. You have to use the latest functions for checking...
Read more >'dict' object has no attribute 'has_key' - Codersarts
'dict' object has no attribute 'has_key'. has_key() is method defined in python 2 so not available in Python 3.
Read more >Dict' Object Has No Attribute 'Key' in Python | Codeigo
Dict ' Object Has No Attribute 'Key' in Python ... The Python error we are discussing here is of AttributeError class. AttributeError generally ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you must use “if key in cdist:”, cdist is your data name
I get an AttributeError: ‘dict’ object has no attribute ‘has_key’ in python 2.7