[Plone-Users] Why Can't I Do This?

Victor Subervi victorsubervi at gmail.com
Fri Dec 14 09:50:26 EST 2007


Great! Thanks!

On Dec 14, 2007 10:38 AM, Eric Smith <eric+plone at trueblade.com> wrote:

> Victor Subervi wrote:
> > Hi;
> > Why can't I do this?
> >
> >  >>> author = "By Juan Garcia"
> >  >>> if author[0:2] == "by " | "By " | "BY":
> > ...   author = author[3:]
> > ...
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > TypeError: unsupported operand type(s) for |: 'str' and 'str'
> >
>
> This is a python question, not a plone question.  The python logical or
> operator is "or", but for this you might want to use "in".  This code
> might point you in the right direction, although it's not a complete (or
> very good) solution:
>
> author = "By Juan Garcia"
> if author[0:2] in ["by", "By", "BY"]:
>     author = author[2:]
> print author
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
>
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Plone-Users mailing list
> Plone-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plone-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071214/f7e0ebf4/attachment.html>


More information about the Python-list mailing list