How to get all of the meshes that are attached to an armature via Python? I know that I can get all of the meshes in a scene by doing this:

 for obj in bpy.data.objects:
     if obj.type == 'MESH':
          # Do stuff


But let’s say I have an armature named rig in the scene, and I have several meshes that have been parented to that armature and have been weighted.

How can I loop through all of the meshes in a scene that are attached to a specific armature?
You can loop through all objects and check if they are parented to the armature.

rig = bpy.data.objects['rig']
for obj in bpy.data.objects:
    if obj.parent == rig:
        # Do stuff
        pass


If some objects are only connected via the armature modifier, simply check that the rig is the object of the armature modifier. 

rig = bpy.data.objects['rig']
for obj in bpy.data.objects:
    if (obj.type == 'MESH' and
        rig in [m.object for m in obj.modifiers if modifier.type == 'ARMATURE']
        ):
        # Do stuff
        pass