How to rename selected objects using python?
You can access them by iterating and assign the name property:

import bpy

for obj in bpy.context.selected_objects:
    obj.name = "newName"


Blender automatically add .001, .002 and so on to newName if another datablock of same type and name already exists. You may need to check a name pattern within the for-loop.

Another example - rename all Mesh objects in current scene that start with C (e.g. Cube, case insensitive):

for obj in bpy.context.scene.objects:
    if obj.type == 'MESH' and obj.name.lower().startswith("c")
        obj.name = "newName"