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


Groups > comp.lang.python > #95822

Re: How to compare lists

Path csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'integers': 0.09; 'tuple.': 0.09; 'wrong,': 0.09; 'missed': 0.15; '"does': 0.16; 'all?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hexadecimal': 0.16; 'set,': 0.16; 'subject:compare': 0.16; 'tuple,': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'not,': 0.22; 'sep': 0.22; 'tuples': 0.22; 'header:In-Reply-To:1': 0.24; 'compare': 0.27; 'message- id:@mail.gmail.com': 0.27; 'sequence': 0.27; 'correct': 0.28; 'about.': 0.29; 'equality': 0.29; "they'll": 0.29; 'there.': 0.30; "i'm": 0.30; 'query': 0.30; 'checked': 0.31; 'guess': 0.31; 'another': 0.32; 'subject:lists': 0.32; 'problem': 0.33; "i'll": 0.33; 'structure': 0.34; 'tue,': 0.34; 'previous': 0.34; 'lists': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'acceptable': 0.35; 'easiest': 0.35; 'exist': 0.35; 'saved': 0.35; 'unit': 0.35; 'but': 0.36; 'serve': 0.36; 'others.': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'seem': 0.37; 'stuff': 0.38; 'does': 0.39; 'rather': 0.39; 'well.': 0.40; 'some': 0.40; 'collection': 0.60; 'save': 0.60; 'your': 0.60; 'more': 0.63; 'talking': 0.67; 'online': 0.71; 'chrisa': 0.84; 'to:none': 0.91; 'ask,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FnEKLD3fjGMtqG/kq28liXB+JlPg9PIfvNeeu0eKFHc=; b=wTivi5aXRloN4UL8Jdajf8SBemTpSkiKWVRHRRMjwr72fHOOBI8dsJFYH3mMk4R2qP 48PRnXTREHhQ4ywtRRLdWF1yxyePKPVtD+xNc1ufMt3HrvaaxiW7fMdeS8lH/2LTQ+r8 BuYlD4/E3cWnpDtE7y3kGZlITfl7RCB2c5HdxH91k4TVyrRGm+lgh+yQjapnEw69dI/q Knw55yGgRtPCNrYjg8JnOuNY+oFaq647/++9aFtC31ZrCzwb95O5l199GkN2zsgFR2La nYIkpM9FV6gJ1RBEaA8RonJJtzQ1jAvxAKYNQ0t112pVSz3Srj1xa80DGgHh40OAJ0Gk hnQA==
MIME-Version 1.0
X-Received by 10.107.36.8 with SMTP id k8mr8240697iok.157.1441092655454; Tue, 01 Sep 2015 00:30:55 -0700 (PDT)
In-Reply-To <55E54F00.15583.2941C4EC@jana1972.centrum.cz>
References <55E54F00.15583.2941C4EC@jana1972.centrum.cz>
Date Tue, 1 Sep 2015 17:30:55 +1000
Subject Re: How to compare lists
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.39.1441092663.23514.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441092663 news.xs4all.nl 23745 [2001:888:2000:d::a6]:35971
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4529
X-Received-Body-CRC 577483844
Xref csiph.com comp.lang.python:95822

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web