Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95822 > unrolled thread

Re: How to compare lists

Started byChris Angelico <rosuav@gmail.com>
First post2015-09-01 17:30 +1000
Last post2015-09-01 17:30 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to compare lists Chris Angelico <rosuav@gmail.com> - 2015-09-01 17:30 +1000

#95822 — Re: How to compare lists

FromChris Angelico <rosuav@gmail.com>
Date2015-09-01 17:30 +1000
SubjectRe: How to compare lists
Message-ID<mailman.39.1441092663.23514.python-list@python.org>
On Tue, Sep 1, 2015 at 3:08 PM, Jahn <jana1972@centrum.cz> wrote:
> 1.
> How can I save 256 lists, each list has 32 values( hexadecimal numbers)
> 2.
> How to compare the saved lists with another 256 lists ( that are read online and have the
> same structure as the list one)?
> ( the first list must be saved in the  previous step)
>
> E.g

You seem to have missed out your example, but I'll guess at what
you're talking about. Correct me if I'm wrong, and we'll move on from
there.

You want to take a sequence of 32 numbers and see if it's exactly the
same sequence as some others. The easiest way to do this is with a
tuple, rather than a list; then you can simply do an equality check,
and they'll be checked recursively. If you want to ask, more simply,
"does this 32-value unit exist in my collection of 256 acceptable
32-value units", then a set will serve you well. You can stuff tuples
of integers into your set, and then query the set for a particular
tuple.

Does that help at all? If not, guide me to the problem you're actually
solving. :)

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web