title: TypeError: String indices must be integer in For Loop
body: <p>I'm aware that this is probably a very simple coding mistake, but I am struggling to find information that reflects the same type of scenario as what I'm facing. I'm sure it's out there, but for the sake of not spending hours hunting it down, I thought I'd just ask it.</p>
  <p>My program is indexing through a binary string, and I'm trying to use a <code>for</code> loop to iterate through the string and remove all the leading <code>0</code>'s. Basically, I just wrote a <code>for</code> loop with <code>j</code> as the indexing var and set it to compare the string at index <code>j</code> to <code>1</code> and if it is <code>1</code> then slice the string at that point onward...else in the case that it's a <code>0</code>. The error is thrown on the if statement line saying <code>TypeError: string indices must be integers.</code> I'm confused because I thought when you set a for loop the index variable is automatically an integer -- is it not?</p>
  <pre><code>imme = &quot;00000000000001001011001100&quot;
  for j in imme:
       if imme[j] == &quot;1&quot;:
            dec_imme = imme[j:]
       else:
            pass
  </code></pre>
  <p>If there are any other ways to do this more efficiently in Python, feel free to comment about those as well.</p>