Newton
asked on
Python : compare 2 files
Hi,
I got 2 files and I need to compare each data and generate boolean output. For eample, from below 2 files i need to take row 1 and column 1 data and compare. If match I need write output as True and if doesnt match then I need output as False.
File 1 : Year 1990
Fruits|count
Apple|100
Orange|200
Red grapes|120
File 2 : Year 2000
Fruits|count
Apple|100
Orange|150
Green grapes|120
Output that I need.
Fruits|Count
TRUE|TRUE
TRUE|FALSE
FALSE|TRUE
What is the best way to do it,
I tried open the file1 and file2 line by line and output to matrix kind of file..and then compare 2 matrix but I never got my output.
Is generating 2 matrix and comparing 2 matrix is the correct way of doing this ?
I got 2 files and I need to compare each data and generate boolean output. For eample, from below 2 files i need to take row 1 and column 1 data and compare. If match I need write output as True and if doesnt match then I need output as False.
File 1 : Year 1990
Fruits|count
Apple|100
Orange|200
Red grapes|120
File 2 : Year 2000
Fruits|count
Apple|100
Orange|150
Green grapes|120
Output that I need.
Fruits|Count
TRUE|TRUE
TRUE|FALSE
FALSE|TRUE
What is the best way to do it,
I tried open the file1 and file2 line by line and output to matrix kind of file..and then compare 2 matrix but I never got my output.
Is generating 2 matrix and comparing 2 matrix is the correct way of doing this ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome Newton! Glad we could help.
ASKER