MY Code:
import bpy
bpy.data.objects["Armature"].select_set(True)
bpy.context.view_layer.objects.active = bpy.data.objects['Armature']
bpy.ops.object.mode_set(mode='EDIT')
obj=bpy.context.object
bone=obj.pose.bones["something"]
if bone is not None:
obj.pose.bones.remove(bone)
bpy.ops.object.editmode_toggle()
Then it shows up this error message
AttributeError: 'bpy_prop_collection' object has no attribute 'remove'