If statement not working properly when else added. The else statement prints when the if statement should.
Doesnt work:
variable = 'programming'
for i, word in enumerate(wv.vocab):
if word == variable:
print("Is ready to be measured")
else:
print("text to clean")
#do this
break
The below works showing the term variable is in the model wv.vocab
variable = 'programming'
for i, word in enumerate(wv.vocab):
if word == variable:
print("Is ready to be measured")
#else:
#print("text to clean")
#do this
break
When the variable is changed to something not in the model it does not work.
variable = 'programmings'
for i, word in enumerate(wv.vocab):
if word == variable:
print("Is ready to be measured")
#else:
#print("text to clean")
#do this
break
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…