title: Find byte pair position in a binary file for editing with Python
body: <p>I have jpeg images stored in binary formats. In need to edit these binaries to delete all the byte pairs that come before <code>0xff 0xd8</code> (as this is the initial part of my jpegs).
  The reason is that when I try to view these files in an image program, they won't open as long as I don't get rid of all the part of bytearray coming before this <code>0xff 0xd8</code> bytes.
  Here's what I tried so far:</p>
  
  <pre><code>data= open ('C:/Users/Umberto/Desktop/_BR_Browse.001_2065642654_1.BINARY', 'rb+')
  edit= str (data.read () )
  data.close ()
  edit.find ('/xff/xd8')
  </code></pre>
  
  <p>but I always receive '-1' as index, for whatever I put as argument using "find" method. What's wrong with the code?
  Once I know the position of <code>/xff/xd8</code>, I would simply delete what comes before it somehow.</p>