Hello everyone, I need someone to combine or fix my Python code, the purpose of
ID: 3917307 • Letter: H
Question
Hello everyone, I need someone to combine or fix my Python code, the purpose of the code is to compare 2 files(.csv), find the differences, mark those differences, then produce the output (csv). This is the FIRST code:
This is the SECOND code:
Here are the the sample files, expected output, and 2 different results from 2 different codes https://imgur.com/a/D2Xf6Ds So the FIRST code above corresponds to Results1.csv and the SECOND code above corresponds to Results2.csv. Red means it is wrong and Yellow means it is missing. I'm trying to combine both of the codes but I keep failing, please help me out. Thanks
Explanation / Answer
The problem is that you are comparing each line in fileone to the same line in filetwo. As soon as there is an extra line in one file you will find that the lines are never equal again. Try this:
or
I assumed your new file was just like your old one, except that some lines were added in between the old ones. The old lines in both files are stored in the same order.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.