How do I get a slice of a string held in a tuple?
lorenzo at excitement.com
Sun Apr 8 19:29:56 CEST 2007
In article <1176050876.835238.68560 at d57g2000hsg.googlegroups.com>,
"mensanator at aol.com" <mensanator at aol.com> wrote:
> On Apr 8, 11:34?am, Lorenzo Thurman <lore... at diespammerhethurmans.com>
> > I have tuple which hold a string in tup. I want to get a slice of
> > that string. I thought I would do something like:
> > tup[start:end]
> > But this fails.
> No, it doesn't.
> >>> a = ('abcdefg','hijkl')
> >>> a
> >>> a[1:2]
> > How do I go about it?
> Do it correctly. Post your actual example that fails
> and the related error message. Possibnly your indexes
> were out of range.
> > I googled this and found a couple
> > of references, but no solution.
> Well, there wouldn't be a solution to a non-existent
> problem, would there?
> > TIA
How would you get a slice of a from your example? 'cde' for example?
"My Break-Dancing days are over, but there's always the Funky Chicken"
--The Full Monty
More information about the Python-list