Link to home
Start Free TrialLog in
Avatar of Newton
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 ?
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Newton
Newton

ASKER

My problem solved in both ways. Thank you Norie and Neeraj.

You're welcome Newton! Glad we could help.