I need to test if a certain string (for example 'võiks') equals the name of any of the files contained in a directory.
>>>words = [ f.replace('.html', '') for f in listdir('lemma_pages/test') if isfile(join('lemma_pages/test',f)) ]
>>>words
['võibolla', 'võid', 'võiks', 'võimalik', 'võin', 'võta', 'võtan', 'võtta']
>>>'võiks' in words
False
But when I test for it, I get False when I expected otherwise. I am opening the file containing the words in this way:
open('et_500.txt', 'rt', encoding="utf-8")
Any idea of what I am not doing right ?