def replace_line(file_name, line_num, find, replace):
    lines = open(file_name, 'r').readlines()
    print("This : ", find, " will be replaced for this: ", replace)
    lines[line_num].replace(find, replace)
    out = open(file_name, 'w')
    out.writelines(lines)
    out.close()
replace_line('text.txt', 3, 'num="200.00"\n', 'num="7.00"\n')
I am trying to replace a specific "str" in a specific line in a text file, however, it does not change anything. Im using Python 3.9
 
     
    