[Solved] Trying to move Weights from one VGroup to another in the Same Mesh Object using Python

I’ve created this tread on Blender Stack Exchange but thought others here might want to know or contribute to the discussion.

Current Code is

import bpy
vgname1 = 'Leg_L'
vgname2 = 'LegD3_L'
vgi1 = -1
vgi2 = -1
vvgi1 = -1
vvgi2 = -1
verts=[]
vWeight=[]

#Get current mode and name for active object
mode = bpy.context.active_object.mode
obname = bpy.context.active_object.name
print(mode, obname)

#Walk through Vertex Groups and determine if the New Group
#already exists, if not, create the new Group Also Get the 
#index numbers for the 2 Groups in question

for ob in bpy.data.objects:
    if ob.name == obname:
        for vgn in ob.vertex_groups:
            if vgn.name == vgname1:
                vgi1 = vgn.index

            if vgn.name == vgname2:
                vgi2 = vgn.index

            if vgi2 == -1:
                ob.vertex_groups.new(name=vgname2)
                for vgn2 in ob.vertex_groups:
                    if vgn2.name == vgname2:
                        vgi2 = vgn2.index
#Test the results
        print( ob.name, vgname1,vgi1, vgname2, vgi2)

#Put the object into Object Mode and get the 
#vertexes that are currently assigned to the group to be removed
#Put the vertex indexes to be moved into a list

        bpy.ops.object.mode_set(mode = 'OBJECT')
        for v in bpy.context.active_object.data.vertices:
            for vg in v.groups:
                if vg.group == vgi1:
                    print(vg.group, vg.weight)
                    verts.append(v.index)
#Ignore            vWeight = vg.weight

#Now add the vertexes to the other group 

                    vg2 = ob.vertex_groups
                    for vga in vg2:
                        if vga.index == vgi2:
                            print(vga.index,vga.name)
                            vga.add(verts, 0, 'ADD')

Ok, this code is really clunky and inflated.
I know that you Python wizards out there can probably do this in 4 lines of code, but I’m just learning and don’t know the shortcuts in coding…(yet). I need to follow the logic without the statements like
for {i in blah: if foo = bar in whatever}. I just can’t wrap my head around those kind of statements yet.

But this does what I need it to do.
I you wish to share how it “should” be written, please do. But please add comments explaining why it is better and what your code does.

import bpy
vgname1 = 'Leg_R'
vgname2 = 'LegD_R'
vgi1 = -1
vgi2 = -1
vvgi1 = -1
vvgi2 = -1
verts=[]
vWeight=[]
x = 0
y = 0
z = 0
mode = bpy.context.active_object.mode
obname = bpy.context.active_object.name

for ob in bpy.data.objects:
    if ob.name == obname:
        
        for vgn in ob.vertex_groups:

            if vgn.name == vgname1:
                vgi1 = vgn.index
                x=x+1

            if vgn.name == vgname2:
                vgi2 = vgn.index
                y=y+1
                
        for vgn in ob.vertex_groups:

            if vgi2 == -1:
                z=z+1
                ob.vertex_groups.new(name=vgname2)

                for vgn2 in ob.vertex_groups:
                    if vgn2.name == vgname2:
                        vgi2 = vgn2.index

        bpy.ops.object.mode_set(mode = 'OBJECT')

        for v in bpy.context.active_object.data.vertices:

            for vg in v.groups:

                if vg.group == vgi1:
                    verts.append(v.index)
                    vg2 = ob.vertex_groups

                    for vga in vg2:

                        if vga.index == vgi2:
                            vga.add(verts, 0, 'ADD')

                    for v1 in bpy.context.active_object.data.vertices:

                        for vg1 in v1.groups:

                            if vg1.group == vgi1:
                                    vWeight = vg1.weight

                                    for v2 in bpy.context.active_object.data.vertices:

                                        if v2.index == v1.index:

                                            for vg2 in v2.groups:

                                                if vg2.group == vgi2:
                                                    vg2.weight = vWeight

            bpy.ops.object.vertex_group_set_active(group=vgname1)
            bpy.ops.object.vertex_group_remove()