[Zope-Coders] x.startswith() vs. x[ ..]

Chris Withers chrisw@nipltd.com
Mon, 03 Dec 2001 09:55:08 +0000


"Barry A. Warsaw" wrote:
> 
> Yep, and I prefer them to slicing even when testing the first or last
> character:
> 
>     if somestring.startswith('^'):
>         # do caret
> 
>     if somestring.endswith('\n'):
>         # don't add it

Hmmm... I wonder if HTMLParser.py could benefit from use of these?

cheers,

Chris