python: why does replace not work?

String.replace(substr)

does not happen in place, change it to:

string = string.replace("http://","")

string.replace(old, new[, max]) only returns a value—it does not modify string. For example,

>>> a = "123"
>>> a.replace("1", "4")
'423'
>>> a
'123'

You must re-assign the string to its modified value, like so:

>>> a = a.replace("1", "4")
>>> a
'423'

So in your case, you would want to instead write

string = string.replace("http://", "")