There have been some great explanations here already, but I felt like chiming in still.
The line of code in your example is a bunch of methods chained together (
method chaining). Each returns a new object and then you call a method on that object. It is possible to rewrite the code in an expanded view. This creates more variables, but it should make it more obvious as to why you are only adding one "pm." prefix.
Here is the code expanded:
cameras = pm.ls(type='camera')
cameraTransform = cameras[0].getParent()
transformMatrix = cameraTransform.getTranslation()
print "Value of z: %s" % tranformMatrix.z