import re
import sys
for line in open(sys.argv[1], 'r').readlines():
    line = re.sub('TargetName=.+', 'TargetName=D:\\\\new', line)
line = re.sub('FriendlyName=.+', 'FriendlyName=big', line)
print(line, end=' ')
Replace a whole line in a txt file