Python Forum

Full Version: comparision of texts in a file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I Have 2 files. Suppose file1.txt contains
name=ravi rollno=9987
name=sri rollno=9988
file2.txt contains
name=ravi rollno=9987 mobileno=9876543212
Now i want to compare the above 2 files and generate a 3rdfile(file3.txt),which contains entries not present in file2.
So file3 should contain
name=sri rollno=9988
The file3 should not contain 'name=ravi rollno=9987' as a part of it is present
How do i proceed?
Please try to write the code, when you get stuck, show what you've done, with any errors (complete and unaltered) and we will be glad to help.