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 <[EMAIL PROTECTED]> 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 > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/plone-users >
-- http://mail.python.org/mailman/listinfo/python-list