I definitely agree with Hannah's suggestion for data in Excel, but if you
have this kind of problem in future and your data is already in Python, you
can use set intersections.

set1 & set2 gives you a set of the elements common to both sets.

If your data are in lists, no problem - set(a_list) will turn a_list into a

So set([your, first, list]) & set([your, second, list])

Sets, unlike lists, are unordered and don't allow duplicates. I tend to
find this is exactly what I am looking for if I am turning a list into a
set (in fact set(a_list) is a very handy way to remove duplicates), but
fair warning, in case this is not what you want.

On Mon, Nov 13, 2017 at 12:15 PM, Kyle Breneman <[log in to unmask]>

> Thanks, everyone, for taking the time to reply to my question!  I liked the
> simplicity of Kyle Bannerjee's command line suggestion, but stumbled over
> how to get the "cat" command to work on my Windows machine and couldn't
> figure out how to properly implement GnuWin32, so I went with a variation
> of Hannah's solution, using this formula in Excel:
> =IF(COUNTIF($C:$C, $A2)=0, "No", "Match!")
> On Fri, Nov 10, 2017 at 4:16 PM, Kyle Breneman <[log in to unmask]>
> wrote:
> > I have 2 Excel files, each with a column of barcodes.  I am supposed to
> > determine which, if any, of the barcodes in the first file are also
> present
> > in the second file.  Is writing a short Python program the best way to do
> > this, or is there a more efficient way?  (There are about 300 items in
> the
> > first file and about 1,000 items in the second file.)
> >
> > Regards,
> > Kyle
> >

Andromeda Yelton
Senior Software Engineer, MIT Libraries:
President, Library & Information Technology Association:
@ThatAndromeda <>