Replace string with wildcard in a .txt file with Python

The code should look like:

import sys
tf = open('tmp', 'a+')
with open('WP8974_AudioDecode.html') as f:
    for line in f.readlines() do:
        if line == '<td>\\frosty\*</td>':
            line = '<td>\\frosty\' + sys.argv[1] + '</td>' 
        tf.write(line)
f.close()
shutil.copy('tmp', 'WP8974_AudioDecode.html')
os.remove('tmp')

I finally found the answer...

test1.txt before Nightly.py executed:

blah
blah
This is a first string
blah
blah

BTW tabs make a difference in the code with notepad++

import sys
import os
import re
import shutil

tf = open('tmp', 'a+')

with open('test1.txt') as f:
    for line in f.readlines():
        build = re.sub ('This is.*','This is a second string',line)
        tf.write(build)
tf.close()
f.close()
shutil.copy('tmp', 'test1.txt')
os.remove('tmp')

test1.txt after Nightly.py executed:

blah
blah
This is a second string
blah
blah