"D'Arcy J.M. Cain" <[email protected]> writes: > On Tue, 16 Dec 2008 13:59:24 -0800 > Scott David Daniels <[email protected]> wrote: >>> > def yesno(s): >> > s = s.strip().lower() >> > if not s in ("y", "n"):
There was a thread about "is not" recently. Python also allows "not in".
if s not in ("y", "n"):
> You could also do this to be a little more user friendly:
> if not (s and s[0] in ("y", "n")):
Or:
if s[:1] not in ("y", n"):
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
