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


Groups > comp.lang.python > #39606

Re: Number validation issue

Path csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.133
X-Spam-Level *
X-Spam-Evidence '*H*': 0.73; '*S*': 0.00; 'stops': 0.07; 'losing': 0.16; 'subject:issue': 0.16; 'wrote:': 0.17; 'context.': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'fixed': 0.28; 'code': 0.31; 'problem.': 0.32; 'shorter': 0.33; 'subject:Number': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'list': 0.35; 'clear': 0.35; 'pm,': 0.35; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'repeat': 0.62; 'solve': 0.62; 'provide': 0.62; 'more': 0.63; 'received:74.208': 0.71
Date Fri, 22 Feb 2013 13:45:30 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: Number validation issue
References <CAJ2vgs5_gYPvMxfBUjs_6QgzUNd4akTvL2p0jV+7E-m8_6xeUw@mail.gmail.com> <CAO+9iGeOQ6jQPfNuG3TSSDK3vFGQVOuWPCgrOcMn+dtJZawj=Q@mail.gmail.com> <CAO+9iGc5bmp9iNveDQ7Bc_LcDDTX6o0rZdr8vHi1aNxYm6go5Q@mail.gmail.com> <CAJ2vgs76po_3JiuqGtLH3b=bP-U1TW-mYYtkxeU-bbx7Z2oHhw@mail.gmail.com> <CAJ2vgs4YvQ+RcKMjEnSimRE3pv3QYbuHuSeHfnU703w1QJr5Ew@mail.gmail.com> <CAJ2vgs5oX0Oxt++K8v8qHdB46ewpoLKQ9QxQX5P3u_NvypFM7g@mail.gmail.com> <CAJ2vgs7yy27HhidfKCkGbqmBUtfB_dx0s_m9xK8x-ETFKjJd+Q@mail.gmail.com>
In-Reply-To <CAJ2vgs7yy27HhidfKCkGbqmBUtfB_dx0s_m9xK8x-ETFKjJd+Q@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:G2qId9qLCK0G1o4P7lVDE/cS+oHwhN5sPuFqxj7Sb/X WkMa7MHTEjxrJMI4Sebe+3pGQSHH2AICypSollfNERWfusCAVL 8gTW51GusPw/VmkRfiwbQC1KlRI7C6Vc2InIc4r/b9MOfEeB+P ZbTOec8PioU78YoJHpLQYNXd2ClgSU3gDT0z2u3WIGxC3rfBRj 5MeAU/naTZSUikBVMpyK1WvxKjRFGQnvm07ACk2uFST9t5rrky WMEcTPQYI/ZwL8cbi5HlVzlnpkQxMYhQHh0u1qNZlRErXRb2o/ wbHSu2uzBxsFdEa6rhjHrSCKJgWEqcTRRFDG4lNlF5kDCSmIA= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2295.1361558753.2939.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361558753 news.xs4all.nl 6896 [2001:888:2000:d::a6]:53844
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39606

Show key headers only | View raw


On 02/22/2013 01:27 PM, Morten Engvoldsen wrote:
> Hi,
> Just to make it more clear: I am looking for how to generate the weight in :
> 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7..  format for any
> length of number instead of
>
> weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1]
>
> only for fixed digit.
>
> My below code can check only for 9 digit, so if we provide a number of more
> than 9 digit, it is not able to check that number. Hope, this makes clear
> what i am looking for...
>
You keep top-posting, so we keep losing the context.

zip() stops at the shorter of the two iterables.  And itertools.cycle() 
will repeat a list infinitely.  The two of them should be able to solve 
your problem.


-- 
DaveA

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


Thread

Re: Number validation issue Dave Angel <davea@davea.name> - 2013-02-22 13:45 -0500

csiph-web