I'm relatively new to python and I am using difflib to compare two files and I want to find all the lines that don't match. The first file is just one line so it is essentially comparing against all the lines of the second file. When using difflib, the results show the '-' sign in front of the lines that don't match and it doesn't show anything in front of the line that does match. (I thought it would show a '+'). For the lines that have a '-' in front, how can I just write those lines to a brand new file (without the '-' in front) ? Below is the code snippet I am using for the difflib. Any help is greatly appreciated.
f=open('fg_new.txt','r')
f1=open('out.txt','r')
str1=f.read()
str2=f1.read()
str1=str1.split()
str2=str2.split()
d=difflib.Differ()
diff=list(d.compare(str2,str1))
print ('\n'.join(diff))