in python load blender file & delete objects
Instead of looping on all object you can do this:

bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)


If you want to delete some specific objects you can use the below script. I had a .blend file (provided below) which has three cubes Cube Cube.001 and Cube.002, in this script I deleted both Cube and Cube.001 where Cube.002 is not deleted.

import bpy

C = bpy.context
scene = C.scene
bpy.ops.object.select_all(action='DESELECT')
for ob in bpy.data.objects:
    if ob.name in ['Cube','Cube.001']:
        ob.select = True
        scene.objects.active = ob
bpy.ops.object.delete(use_global=False)


.blend file can be found here: