There is a text file with the key word. Is approximately like this:
There is also a list (text file) from which I want to replace key words. The key word is the same, the values for the substitutions are all different.
View the list of substitutions:
and so on.
I made the following script in Python (version 3.5.1):
list = 
with open('d:/attachment.txt','r') as inf:
list = inf.read()
file = open('d:/new_1.txt', 'r')
text = file.read()
num_of_words = text.count('Image')
for i in range(0, num_of_words):
text = text.replace('Image', 'list', 1)
file = open('d:/new_1.txt', 'w')
attachment.txt - repository for a list of substitutions (attachmentid), new_1.txt file where change is made.
This code substitutes the entire list for each occurrence of the keywords. I would like to for the first occurrence of the keywords you inserted the first item of the list, second for second, etc:
Keyword = [attachmentid=1923106]
Keyword = [attachmentid=1923108]
Please tell me how to fix these things.
PS don't know Python only a little less than completely. Code compiled with the help of Google and answers from StackOverflow.