How to check if a string is empty in python?

Roy Smith roy at panix.com
Thu May 3 09:38:56 EDT 2007


In article <1178195992.473679.137560 at n59g2000hsh.googlegroups.com>,
 Ant <antroy at gmail.com> wrote:

> On May 3, 5:59 am, a... at mac.com (Alex Martelli) wrote:
> > Steven D'Aprano <s... at REMOVEME.cybersource.com.au> wrote:
> > > On Wed, 02 May 2007 21:19:54 -0400, Roy Smith wrote:
> >
> > > > for c in s:
> > > >    raise "it's not empty"
> >
> > > String exceptions are depreciated and shouldn't be used.
> >
> > >http://docs.python.org/api/node16.html
> >
> > They're actually deprecated, not depreciated.
> 
> In Steven's defence, string exceptions *are* probably worth less, as
> there's no longer such a demand for them.

You just wait until they start showing up on Antiques Roadshow :-)



More information about the Python-list mailing list