if-else with '|' operator - beginner's question/problem
opengeometry at yahoo.ca
Wed Aug 8 19:49:15 CEST 2001
On Wed, Aug 08, 2001 at 06:25:31PM +0100, Lee wrote:
> 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
> >>> if (fname == 'a'|'e'|'i'|'o'|'u'):
'|' is bit-wise operator which operates on plain/long integers only.
What you want is
if (fname == 'a' or fname == 'e' or ...):
if (fname in 'aeiou'):
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8 CPUs cluster, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Sc.
More information about the Python-list