Searching file for the same string twice and printing both separately
<p>I am a beginner python programmer with a search question. I need to locate a string of DNA in a DNA file. The issue is that I do not know where the string appears in the file, it appears twice, and I need to know both locations. My current program can only find the first string and I am having difficulty having it continue the search to find the second.  My two ideas that I have have both failed but I think only because I do not understand how to use the functions. Here they are:</p>

<ol>
<li><p>use .seek() to find the first string of DNA I need and set that as the starting point for a second search. My problem is that I do not know exactly where the DNA strings are, so I tried to set my seek location to the DNA string.  This wont work however, as the data needs to be in bytes to find a location, not a string.  I tried to use .index() the location of the DNA string and setting that as a variable, but that also does not work.</p></li>
<li><p>Use .split() to split the DNA text file after the first DNA string was found then running a second search on the right half of the break. I thought this would work, but I only end up with an error reading:</p>

<p>IndexError: list index out of range</p></li>
</ol>

<p>specifically, I am writing .split('str')[1] to use the second half of the string.</p>

<p>Assuming my logic is correct in the program, would these approaches work? Does anyone have a different idea they think I should try? </p>