Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'element': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '"0"': 0.16; '"x"': 0.16; '>does': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'string)': 0.16; 'values?': 0.16; 'print': 0.22; 'integer': 0.24; 'replace': 0.24; 'url:home': 0.24; 'header:X-Complaints-To:1': 0.27; 'character': 0.29; "doesn't": 0.30; 'probably': 0.32; 'running': 0.33; 'fri,': 0.33; 'but': 0.35; 'found.': 0.36; 'skip:> 10': 0.36; 'charset:us- ascii': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'name:': 0.61; 'range': 0.61; 'simple': 0.61; 'expectations': 0.74; 'working,': 0.84; 'subject:Lists': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: I am out of trial and error again Lists Date: Sat, 25 Oct 2014 14:47:56 -0400 Organization: IISS Elusive Unicorn References: <3082ee74-3182-4ea5-9851-2b1326e5b34c@googlegroups.com> <9a1l4athfj10h7r3v69ddo95285n9cjlms@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-218-175.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414262886 news.xs4all.nl 2948 [2001:888:2000:d::a6]:46284 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79680 On Fri, 24 Oct 2014 15:07:06 -0400, Seymore4Head declaimed the following: >It doesn't print what I expect. Which probably means it is working, and your expectations are wrong. >Does it print what you expect? > Without running it in an interpreter... >name="123-xyz-abc" >for x in name: "x" will be one character from the string > if x in range(10): Is that CHARACTER (1 element string) found in a range of integer values? > print ("Range",(x)) > if x in str(range(10)): Is that CHARACTER found in a STRING of (Py3) 'range(0, 10)' or (Py2) '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]' Now, in Py2, that should actually work -- but only by coincidence. In Py3, only "0" and "1" will be found. Replace all your usage of "range(10)" with a simple string "0123456789" and see what happens... -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/