Hi there, I started Python today. My first mini-project is supposed to find strings in a text-file. Here is what I have written:
infile = open("Python/es.txt","r") text = infile.read() infile.close() print text search = 'du' index = text.find(search) if index==-1: print "nothing found" else: search, "found at index", index
in ex.txt is written:
m du asdf
I expect an output of "du found at index ..." however I get "nothing found".
the "print text" command returns:
in the notepad++ console
■m d u a s d f
in the command line console.
Any tips on how to fix?