Re: How to get a substring with variable indices

2006-12-18 Thread Станислав Ягло
Tim Chase wrotes: >> I have a string named text. I need to extract a substring from it >> starting by variable 's' and ending by 'e'. >> >> text[s:e] generates the following error: >> >> TypeError: slice indices must be integers or None > > Your syntax is correct...the error you get back is th

Re: How to get a substring with variable indices

2006-12-18 Thread Tim Chase
> I have a string named text. I need to extract a substring from it > starting by variable 's' and ending by 'e'. > > text[s:e] generates the following error: > > TypeError: slice indices must be integers or None Your syntax is correct...the error you get back is the clue: either "s" or "e

Re: How to get a substring with variable indices

2006-12-18 Thread Paul Rubin
ÁâÐÝØáÛÐÒ ÏÓÛÞ <[EMAIL PROTECTED]> writes: > text[s:e] generates the following error: > TypeError: slice indices must be integers or None > > How to be? :) s and e both have to be integers or None. Try printing them out just before your slice to see if their values are reasonable. >>> s