Replacing part of an object's name with object.name.replace?
Replace is a string function that comes from python's string object.
Since an object's name is a string property class, that inherits some props and methods from python's built in string class, it also gets the replace method.

The string replace method doesn't replace in place, but returns a string with the replacement applied. Which means that what you actually need to do is:

bpy.context.object.name = bpy.context.object.name.replace("_HP", "_LP")