Re: if statement multiple or

2011-05-06 Thread Tim Golden
On 06/05/2011 14:17, scattered wrote: On May 6, 8:25 am, Christian Heimes wrote: Am 06.05.2011 14:09, schrieb scattered: sets could also work if set('abc')& set(line) == set(): print line Right! Sets work in this special case, because the OP just wants to search for a single char.

Re: if statement multiple or

2011-05-06 Thread scattered
On May 6, 8:25 am, Christian Heimes wrote: > Am 06.05.2011 14:09, schrieb scattered: > > > sets could also work > > > if set('abc') & set(line) == set(): > >      print line > > Right! > Sets work in this special case, because the OP just wants to search for > a single char. It won't work for long

Re: if statement multiple or

2011-05-06 Thread Christian Heimes
Am 06.05.2011 14:09, schrieb scattered: > sets could also work > > if set('abc') & set(line) == set(): > print line Right! Sets work in this special case, because the OP just wants to search for a single char. It won't work for longer strings, though. Also I would write the test as: if set

Re: if statement multiple or

2011-05-06 Thread scattered
On May 6, 7:00 am, Christian Heimes wrote: > Am 06.05.2011 12:47, schrieb Lutfi Oduncuoglu: > > > Hi, > > > I am trying to write a script and I realised that I need to use something > > like > > > if ('a' or 'b' or 'c')  not in line: > >    print line > > > But it does not work for. What may be th

Re: if statement multiple or

2011-05-06 Thread James Mills
On Fri, May 6, 2011 at 8:47 PM, Lutfi Oduncuoglu wrote: > I am trying to write a script and I realised that I need to use something > like > > if ('a' or 'b' or 'c')  not in line: >    print line > > But it does not work for. What may be the problem You will need to (naively) do this: if "a" not

Re: if statement multiple or

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 4:02 AM, Albert Hopkins wrote: > On Fri, 2011-05-06 at 13:47 +0300, Lutfi Oduncuoglu wrote: >> Hi, >> >> I am trying to write a script and I realised that I need to use >> something like >> >> if ('a' or 'b' or 'c')  not in line: >>    print line >> > > The expression: >    

Re: if statement multiple or

2011-05-06 Thread Albert Hopkins
Correction: ('a' or 'b' or 'c') evaluates to 'a' -- http://mail.python.org/mailman/listinfo/python-list

Re: if statement multiple or

2011-05-06 Thread Albert Hopkins
On Fri, 2011-05-06 at 13:47 +0300, Lutfi Oduncuoglu wrote: > Hi, > > I am trying to write a script and I realised that I need to use > something like > > if ('a' or 'b' or 'c') not in line: >print line > The expression: ('a' or 'b' or 'c') evaluates to True True not in line Is

Re: if statement multiple or

2011-05-06 Thread Christian Heimes
Am 06.05.2011 12:47, schrieb Lutfi Oduncuoglu: > Hi, > > I am trying to write a script and I realised that I need to use something > like > > if ('a' or 'b' or 'c') not in line: >print line > > But it does not work for. What may be the problem if any(s not in line for s in ('a', 'b', 'c'))

if statement multiple or

2011-05-06 Thread Lutfi Oduncuoglu
Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c') not in line: print line But it does not work for. What may be the problem Thanks, Lutfi -- http://mail.python.org/mailman/listinfo/python-list