[Tutor] string.replace

alan.gauld@bt.com alan.gauld@bt.com
Wed, 12 Sep 2001 10:49:55 +0100


> >>> from string import *
> >>> 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)
                  return striptabs(line)
> ... 	return line

You eren't returning the result to the top level so only 
the top level actually did anything....

Alan g.