complex if statement in python

Posted by Neverland on Stack Overflow See other posts from Stack Overflow or by Neverland
Published on 2010-03-22T15:21:27Z Indexed on 2010/03/22 15:51 UTC
Read the original article Hit count: 364

Filed under:

I need to realize a complex if-elif-else statement in Python but I don't get it working.

The elif line I need has to check a variable for this conditions:

80, 443 or 1024-65535 inclusive

I tried

if
  ...
  # several checks
  ...
elif (var1 > 65535) or ((var1 < 1024) and (var1 != 80) and (var1 != 443)):
  # fail
else
  ...

© Stack Overflow or respective owner

Related posts about python