Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'string.': 0.04; 'escape': 0.07; 'subject:Error': 0.07; "'''": 0.09; 'substring': 0.09; 'thursday,': 0.13; 'def': 0.14; 'thu,': 0.15; 'copy-pasted': 0.16; 'inputs': 0.16; 'wrote:': 0.16; 'string,': 0.18; 'working.': 0.18; 'portion': 0.20; 'trying': 0.22; 'fine,': 0.22; 'am,': 0.23; 'appears': 0.23; '2015': 0.23; 'replacing': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.25; 'message- id:@mail.gmail.com': 0.28; 'fine': 0.29; 'multiline': 0.29; 'spaces': 0.29; 'symbols': 0.29; 'print': 0.31; 'quotes': 0.33; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'problem.': 0.35; 'reply.': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'skip:i 20': 0.37; 'thank': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'gave': 0.63; 'dear': 0.67; 'sir,': 0.79; '"fine"': 0.84; 'to:name:python': 0.84; 'unnecessary,': 0.84; 'utc+5:30,': 0.84; 'results,': 0.91; 'reply,': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ykWXr57KGJn3xfyCQzxjl/k4gEC68yz2DW0cuF5uF1Q=; b=dYKkxuSZI6rKk4NhF4Putgr1CDihJJq04/k2y/7Y71VrnAM+ru2k01NLKtRAfo/BtX c1AD3KSR/+9iQ2lzRWVDvQwQMjny/3up8+4cgh2L9mXdCToG/Sc6yfrVAeDZMbRcBiGJ tzWMlazZK3FHKBT8YXF96NL88w/cCJXTQwg1DKjOI5++vvegAUEA1T312Nx4+L0lx7Sp G3dEns0clRjpKS6H2ZEHm4B26/bNqhaRl5WXaXfKry4U8iFZwOF1nP3Oa28OPcSTxqYa 3KNcS++hLPAEVGeCGTbiGlsneMQCB4uBvKFiD59/ugiXzl6aLwDreBIIzX4tYx9sljQ/ Ph6A== X-Received: by 10.129.56.70 with SMTP id f67mr12831609ywa.85.1434041290655; Thu, 11 Jun 2015 09:48:10 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <6a171772-23a5-471d-a4e5-73f195c9055c@googlegroups.com> References: <3bf5dd52-c698-4392-be2b-5c0aeefc3cd3@googlegroups.com> <6a171772-23a5-471d-a4e5-73f195c9055c@googlegroups.com> From: Ian Kelly Date: Thu, 11 Jun 2015 10:47:30 -0600 Subject: Re: Error in or To: Python 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434041298 news.xs4all.nl 2897 [2001:888:2000:d::a6]:37139 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92491 On Thu, Jun 11, 2015 at 10:39 AM, wrote: > On Thursday, June 11, 2015 at 9:20:59 PM UTC+5:30, Ian wrote: >> On Thu, Jun 11, 2015 at 9:40 AM, >> > if write this it is working fine, but if I write >> > >> > if ("AND" in inp1) or ("OR" in inp1) or ("NOT" in inp1) or (">" in inp1) or ("&" in inp1) or ("MAYBE" in inp1) or ("(" in inp1) or ("*" in inp1) or (''' " ''' in inp1): >> > >> > the portion of (''' " ''' in inp1) is not working. >> >> Not working how? I copy-pasted the line and it appears to work fine. > > Dear Sir, > Thank you for your kind reply. Nice to know your reply, but I am trying to send you my experiment, please see my results, > >>>> def input1(n): > inp1=raw_input("PRINT YOUR QUERY:") > if ("AND" in inp1) or ("OR" in inp1) or ("NOT" in inp1) or (">" in inp1) or ("&" in inp1) or ("MAYBE" in inp1) or ("(" in inp1) or ("*" in inp1) or (''' " ''' in inp1): > print "FINE" > > >>>> input1(1) > PRINT YOUR QUERY:"Java" >>>> input1(1) > PRINT YOUR QUERY:"Obama in London" >>>> input1(1) > PRINT YOUR QUERY:Obama AND Bush > FINE >>>> input1(1) > PRINT YOUR QUERY:Obama OR Bush > FINE >>>> > > you may get better my problem. The substring that you're looking for has spaces around the " symbol. The example inputs that you gave don't have spaces around the " symbols, so they don't contain the substring. The triple quotes are also unnecessary, though harmless -- it's not a multiline string, and there are no ' symbols to escape in the string. Try replacing the substring with just this: '"'.