In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On Apr 8, 12:29�pm, Lorenzo <[EMAIL PROTECTED]> wrote: > > In article <[EMAIL PROTECTED]>, > > > > > > > > > > > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > On Apr 8, 11:34?am, Lorenzo Thurman <[EMAIL PROTECTED]> > > > wrote: > > > > I have tuple which hold a string in tup[0]. I want to get a slice of > > > > that string. I thought I would do something like: > > > > tup[0][start:end] > > > > But this fails. > > > > > No, it doesn't. > > > > > >>> a = ('abcdefg','hijkl') > > > >>> a[0] > > > 'abcdefg' > > > >>> a[0][1:2] > > > 'b' > > > > > > 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 > > > > Here's the code: > > > > elapsedTime = mydata[1] > > index = elapsedTime.find("real") > > # the index will have a value 0f 110 > > totaltime = elapsedTime[index:] > > # instead of this returning a shortened html string, i only > > # get the left angle bracket '<' > > This implies that '<' is the 111th character (counting > from 0) and that it is the last character since you used > [index:]. > > Print out the entire string elapsedTime, count from > 0 to the characters you want and see if you have the > correct index numbers (verify them). > > > > > > -- > > "My Break-Dancing days are over, but there's always the Funky Chicken" > > --The Full Monty Oops! I sent the wrong piece of code. The above is actually the work around which actually works. The bad code is this: index = mydata[0].find("real") elapsedTime = mydata[0][index:] My apologies, but this is what fails. -- "My Break-Dancing days are over, but there's always the Funky Chicken" --The Full Monty
-- http://mail.python.org/mailman/listinfo/python-list