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

Victor Subervi victorsubervi at gmail.com
Fri Dec 14 11:21:36 EST 2007


whatever[0:2] will yield THREE characters, so my "by " is correct and "by"
will fail every time :))
Victor

On Dec 14, 2007 12:06 PM, Derek Broughton <derek at pointerstop.ca> wrote:

> Encolpe Degoute wrote:
>
> > Derek Broughton a écrit :
> >> 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'
> >>
> >> because | is unsupported, and it doesn't make sense that way.
> >>
> >> Wouldn't:
> >>  if author[0:2].lower() == "by":
> >> make more sense (btw, that trailing space in your "by " would have made
> >> it fail anyway).
> >
> > Are you sure of this ?
>
> Yes, because I executed it in python...
>
> --
> derek
>
>
> -------------------------------------------------------------------------
> 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/d3d5198c/attachment.html>


More information about the Python-list mailing list