'Python - read file - increment number - save file [closed]

I hope you can help with something quite simple, but im clearly not having clarity working it out.

I have a bunch of images (image1.jpg, image2.jpg, image3.jpg...you get the picture.)

I have a python script that I would like to read a file which contains the number of the image last sent, increment it by 1, and save the file with the new number, so the next time it runs, it would pick up and increment the next number. Image1 becomes Image 2 etc etc

Ive done some looking around and failing miserably and overcomplicating what I think is something quite simple.

Can someone save me from my torment??

Thanks everyone!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source