I am trying to put a variable that is in a text file between two strings. For example, I have a text file like this:
123
456
789
I want to loop through each line and append it to two strings:
'The number,' 123 ' appears in the list'
'The number,' 456 ' appears in the list'
'The number,' 789 ' appears in the list'
a = str('This number')
b = str(' appears in the list')
file = open(r"My\File\Path\Example.txt", "r")
lines =len(file.readline())
for lines in file:
print(a, print(file.readline(), b))