I am really new to python and I have two csv file. The first one (more.csv) has content of
A123,B456,C789
The second one (less.csv) has content of
B456
I want so that when they are the same they store the similar item into a variable called “same”
I figure it would start with something like:
more = open('more.csv','r')
less= open('less.csv','r')
for item in unitid:
Thank you.
If they’re only one line, you can use the set object (a python built-in) to compare them, for instance:
The full method to compare from files would look like:
If they are more than a single line per file, then you’d still be able to use this, you’d just have to modify it a bit – I guess storing the intersections into an array that represents the line-by-line similarities or something.