'Replace every occurence in a file with a list elements - every next occurence with a list's next element

Suppose, I need to replace every 's' in the file, provided I know there are three of them, replacing every occurence on occurence-per-list-element basis:

This is my test

list: [1, 2, 3]

Desired output after a replacement:

Thi1 i2 my te3t

What is the most elegant/pythonic way to do it?



Sources

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

Source: Stack Overflow

Solution Source