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: 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 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Sep 1, 2015 at 3:08 PM, Jahn 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