if-else with '|' operator - beginner's question/problem

Lee lee.r2d2 at ntlworld.com
Wed Aug 8 13:25:31 EDT 2001


Hi there, I wonder if someone could possibly tell me what is wrong with
the following statement. I'm extremely embarrased to ask but here
goes...

>>>  if (fname[1] == 'a'|'e'|'i'|'o'|'u'):
    vowel='true'

Traceback (innermost last):
  File "<pyshell#46>", line 1, in ?
    if (fname[1] == 'a'|'e'|'i'|'o'|'u'):
TypeError: bad operand type(s) for |

---
fname[1] gives 'e'

Thanks very much in advance!

Lee




More information about the Python-list mailing list