title: incrementing image number python
body: <p>I am trying to rename those images so image_0596(2) changed to iamge_0596 After that I want to increment the file number so previous image_0596 =&gt; image_0597 and previous image_0598 =&gt; image_0599 ......
  However, the block of my code doesn't replace anything.</p>
  <pre><code>from itertools import count
  import os
  def main():
  path =''
  lst = os.listdir(path)
  os.chdir(path)
  for filename in os.listdir(path):
      if filename.endswith('.jpg'):
          filename = (&quot;image_%04i.jpg&quot; % i for i in count(1))
  </code></pre>
  <p><a href="https://i.stack.imgur.com/7F2Dc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7F2Dc.png" alt="enter image description here" /></a></p>