Admittedly, I have an inferior knowledge on this API. It is somewhat low level but nevertheless powerful than the other Python APIs.
You can check a general overview on the official documentation.
Another comprehensive getting started resource.
1import maya.api.OpenMaya as om # API 2.0 2 3import maya.api.OpenMayaAnim as omanim 4import maya.api.OpenMayaRender as omrender 5 6import maya.OpenMaya as om # API 1.0. No reason to use except for legacy purposes
1from maya.api.OpenMaya import MVector, MMatrix, MPoint 2import maya.cmds as cmds 3 4def get_world_transform (obj): 5 return MMatrix ( cmds.xform( obj, q=True, matrix=True, ws=True ) ) 6 7selected_object = (cmds.ls(sl=1,sn=True)) 8 9print ( get_world_transform( selected_object ) )