lstm-char-cnn-tensorflow
lstm-char-cnn-tensorflow copied to clipboard
AttributeError: 'dict' object has no attribute 'has_key'
I 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)
@jingweimo
Did you get a solution to this? I am facing the same issue.
use contains instead
in python 3.5 the method has_key has been removed. Maybe you could try python2.7
I get an AttributeError: 'dict' object has no attribute 'has_key' in python 2.7
you must use "if key in cdist:", cdist is your data name