You probably intended
for i in range(len(tagFinder)):
content = content.replace(tagFinder[i],safeTag[i])
..........
return content
instead of
for i in content:
return content.replace(tagFinder[i],safeTag[i])
and also you are prematurely exiting the loop because of the return statement. The return statement should be the last statement in your function, assuming these statements are in a function
but then it is always better to use the built-in zip here
for src, dest in zip(tagFinder , safeTag ):
content = content.replace(src, dest)
..........
return content
but then, unless this is part of a homework, you should use the standard library to escape your html string. In this particular case, cgi will be useful.
>>> import cgi
>>> cgi.escape(data).encode('ascii', 'xmlcharrefreplace')
'<>&'