I'm having a hard time understanding this for loop. I am new with python so I don't understand what exactly is happening here. The code is for html escaping.
My question is: How does the for loop get executed? why does for(i,o) in (.........) how is this ever true? how does it know there is an & symbol in the string s?
def escape_html(s):
for(i,o) in (("&", "&"),(">",">"),('<','<'),('"',""")):
s=s.replace(i,o)
return s
print escape_html("hello&> this is do\"ge")