On Thursday, June 11, 2015 at 10:18:33 PM UTC+5:30, Ian wrote: > 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: '"'.
Dear Sir, Thank you. It seems working. Regards, Subhabrata Banerjee. -- https://mail.python.org/mailman/listinfo/python-list