Hi. I'm very new to python and I'm trying to write something that is conceptually very simple but I'm not sure how to approach it in python.

I have 2 files, and basically want to open one file, and replace the content with something in another file.


file1.txt only has the letter 'a' in it.

file2.txt has a list of numbers, e.g. 1, 2, 3, 4, 5...

What i want to do is open file1.txt, search and replace 'a' with the first number in the list in file2.txt, e.g, replace 'a' with '1'. After that I want to save as the file as file1.1.txt and then loop it, going through the file2.txt list. At the end I should have 5 different files in this example.

Any suggestions would be appreciated.

Since you already know what you want to do, just read up on how to read and write to file, and how to execute a loop.