# select out tangents, change outTangent flag to inTangent for in tangents
import pymel.core as pm
curvelist = pm.keyframe(q=True, sl=True, name=True)
for curve in curvelist:
sel_keys = pm.keyframe(curve, q=True, sl=True) # returns list of frames
for i in range(len(selKeys)):
pm.selectKey(curve, time=selKeys[i], outTangent=True, add=True)