Here’s a quick script I threw together today that will take your selection, check if any of the nodes have animation curves attached to them, and then deselect all the nodes that aren’t animated. Leaving you only with the nodes that are animated. I say nodes because it will keep any node in Maya you have intially selected whether it’d be a transform, a shape, or a nParticle node. So, be careful with your initial selection and you won’t have to worry about what you get out in the end.

objs = mc.ls(sl=True,dag=True)
print objs
animated = []
for obj in objs:
    findAnimCurves = mc.listConnections(obj,source=True,type="animCurve")
    if findAnimCurves:
        animated.append(obj)
mc.select(animated,replace=True)