title: Keeping track of number of characters removed in strings, python `strip()`
body: <p>I have a pair of strings. In this case, let's think of them as two separate strings assigned to unique variables. These strings have equal length:</p>
  
  <pre><code>var1 = 'AnAppleADayKeepsTheDoctorAway'
  var2 = '000Ig00000noranceIsBliss00000'
  </code></pre>
  
  <p>The most efficient way I know to strip beginning and trailing characters from a string in Python is the method <code>strip()</code>:</p>
  
  <pre><code>print(var2.strip('0'))
  'Ig00000noranceIsBliss'
  </code></pre>
  
  <p>I would like to remove the same number of character from the string <code>var1</code>, as they are a "pair". In this case, that would be remove the first three characters and the trailing five characters, i.e.</p>
  
  <pre><code>'ppleADayKeepsTheDocto'
  </code></pre>
  
  <p>Is there a method which allows me to efficiently strip characters like in <code>var1</code> and then keep track of the number of these characters to do the same for the second string,<code>var2</code>? I'm not sure <code>strip()</code> would be the best method for this task.</p>
  
  <p>EDIT: Obviously, there's a solution. </p>
  
  <p>e.g. </p>
  
  <pre><code>length_original = len(var2)
  num_left_chars = len(var2) - len(var2.lstrip('0'))
  num_right_chars = len(var2.rstrip('0'))
  edited = var1[num_left_chars:num_right_chars]
  print(edited)
  ## printed
  ## 'ppleADayKeepsTheDocto'
  </code></pre>
  
  <p>I'm looking for an <em>efficient</em> solution. If there a quicker Pythonic method?</p>