<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The amazing thing is when file_str  = 'C:\Qt\SimLCM\Default<br>
\Data_Input_Material.txt',<br>
the first if statement if fulfilled, that seemingly says that in this<br>
file_str, python actually finds the word 'Geometry'.<br>
I know this, because the line: 'I found geometry' is printed. However,<br>
if instead of using file_str.find(), I use file_str.endswith(), it<br>
does not exhibit this strange behaviour.<br>
<br></blockquote><div><br></div><div>The problem is str.find returns -1 on failure; and -1 is a true value. Only 0, empty string, empty sequences, etc, are false values.</div><div><br></div><div>So, you have to test, 'if find_str.find(pattern) != -1:'</div>

<div><br></div><div>HTH,</div><div><br></div><div>--S</div></div>