On May 3, 8:50 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Wed, 02 May 2007 13:35:47 -0700, noagbodjivictor wrote:
> > How to check if a string is empty in python?
> > if(s == "") ??
>
> In no particular order, all of these methods will work:
>
[snip]
>
> # test that s has none of any character
> if not filter(None, [1 + s.find(chr(n)) for n in range(256)]):
>
> That last one is really only good for wasting CPU cycles.

Have you considered
    if not re.match(".+$", s):
?


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to