[Tutor] string.replace

Allan Crooks allan.crooks@btinternet.com
Wed, 12 Sep 2001 01:30:02 +0100


On 11 Sep 2001, at 17:08, Jon Cosby wrote:

> >>> def striptabs(line):
> ... 	if "<" in line:
> ... 		l = find(line, "<", 0)
> ... 		m = find(line, ">", l)
> ... 		if l and m:
> ... 			print "Tag found"		# Test
> ... 		line = replace(line, line[l:m+1], "")
> ... 		striptabs(line)

This line should be "return striptabs(line)". Otherwise it's returning 
the line which has the first tag removed (it processes the rest of the 
string, but does nothing with it. 

> ... 	else:
> ... 		return line
> ... 	return line

Allan.