Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'win32': 0.03; 'syntax': 0.04; 'interpreter': 0.05; 'string.': 0.05; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'windows': 0.15; 'fails.': 0.16; 'inc.)': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'side.': 0.16; 'syntaxerror:': 0.16; 'bit': 0.19; '>>>': 0.22; 'appears': 0.22; 'error': 0.23; 'url:home': 0.24; 'question': 0.24; 'somewhere': 0.26; 'asking': 0.27; 'header:X-Complaints- To:1': 0.27; '(c)': 0.29; '2009': 0.29; "doesn't": 0.30; 'that.': 0.31; '"",': 0.31; 'sep': 0.31; 'file': 0.32; 'skip:c 30': 0.32; 'another': 0.32; 'fri,': 0.33; 'false': 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; 'number,': 0.60; 'range': 0.61; 'more': 0.64; 'reserved.': 0.68; 'invalid': 0.68; '2013,': 0.91; '800': 0.91; '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:37:11 -0400 Organization: IISS Elusive Unicorn References: <2412654f-ac5e-4678-8956-afc4e27affb3@googlegroups.com> <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: 69 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414262235 news.xs4all.nl 2910 [2001:888:2000:d::a6]:40969 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79678 On Fri, 24 Oct 2014 14:15:13 -0400, Seymore4Head declaimed the following: > >I do understand that. 7 is a number and "7" is a string. >What my question was...and still is...is why >Python 3 fails when I try using >y=1 800 get charter > >y in range str(range(10)) Really... Did you try at an interpreter prompt? Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Wulfraed\Documents>python3 ActivePython 3.3.2.0 (ActiveState Software Inc.) based on Python 3.3.2 (default, Sep 16 2013, 23:11:39) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> y=1 800 get charter File "", line 1 y=1 800 get charter ^ SyntaxError: invalid syntax >>> y = "1 800 get charter" >>> >>> y in range str(range(10)) File "", line 1 y in range str(range(10)) ^ SyntaxError: invalid syntax >>> >should work because y is a string and str(range(10)) should be Yes... BUT: >>> y in str(range(10)) False >>> str(range(10)) 'range(0, 10)' >>> "1 800 get charter" in "range(0, 10)" False >>> >>> "1 800 get charter" in "call 1 800 get charter now to get robbed" True >>> y in "call 1 800 get charter now to get robbed" True >>> >"y" in str(1) fails. >It doesn't give an error it's just not True when y is a number. > "y" is not a number, and neither is what you have on the right side. You are asking if a string appears somewhere inside another string. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/