Why isn't word in word_list?
When I run the code, it runs as if 'core\n' (the value of word) and 'core\n' (the value of a word_list item) aren't the same. What am I doing wrong?
That's because in your list there is
core\n, but not
'core\\n', which is the content of your variable
word should be like this:
word = base_word+"\n"
@AIC27 No. When you read the line it gets stored as [word]\n in the variable, so when you want to check if the list contains your word then your variable literally needs to be [word]\n as value too. If you escape the escape char your variable will hold the value [word]\n.
Your issue is that you did escape it in the variable you check with, but not in the word list.
There is no reason for you to escape it and I guess you misunderstood in which case you do need to escape something.
Just test what I have said and you will notice that it is the solution to your problem.