I assume the OP has already done manually what the OP needs to do.
You might consider deleting all groups and parent again ... to Single Bone which was previously selected. Consult a Tutorial Video, one or more. I am trying to avoid writing a tutorial.
We assume rigid mechanical motion .. so only one bone should have influence. What follows is a short explanation. Edit Mode Show Weights is selected. The bones are outside the mesh only for visibility and discussion purposes. Bones are typically near the mesh.
Below preparing to delete mistake groups.
When deleting you can delete one by one. You can also lock (the lock symbol in vertex groups) and then delete all unlocked groups from the menu. Tutorial Slippery Slop ... I mean Slope.
Image Below a mistake needs to be corrected,
Correct bone group appears. Mistake bone groups were deleted.
All vertices were selected in edit and the weight 1.0 assigned in the Vertex Groups Panel by clicking the button [Assign]
There are videos on famous video websites that show many of the bone weighting features. It serves you best to see those because its more entertaining for you and the features are quite numerous so video may be the best format. There are multiple ways to get something done in Blender. Single Bone Parent is possible. Please consult a video. Scripts were not discussed.