Need Help with Code to List Layers and their Data Frames

Discussion created by DevDep on May 19, 2014
Latest reply on May 19, 2014 by mdenil
Hey all!

I am relatively new to the forums (and Python) so please let me know if I am asking a question that is already answered elsewhere.

Basically I am trying to edit a code given to me in order to list all the layers in my .mxd and correlate them to the data frame they are in.  Right now I have this code:

import arcpy
mxd = arcpy.mapping.MapDocument(r"FILENAME")
for lyr in arcpy.mapping.ListLayers(mxd):
    if lyr.supports("DATASOURCE"):
        print "Layer: " + + "  Source: " + lyr.dataSource

Which was given to me, I have tried a few different options in the past week on my spare time to see if I could get it working to no luck yet.  Is this code editable to the point of being able to also show the data frame name along with what information is already being shown?

Any help/guide in the right direction will be more than appreciated. Thanks!