AnsweredAssumed Answered

print arcpy.mapping.ListLayers confusion

Question asked by j256 on Feb 27, 2013
Latest reply on Feb 27, 2013 by mzcoyle
Hi. I'm a little confused and I want to understand this better.

If I enter:

arcpy.mapping.ListLayers(mxd)[0]


...the python console returns <map layer u'A'>

If I enter:

print arcpy.mapping.ListLayers(mxd)[0]


...the console returns just the layer name, A

However, if I use slice notation as follows:

print arcpy.mapping.ListLayers(mxd)[0:2]


...why does Python return [<map layer u'A'>, <map layer u'B'>] instead of just A,B ?

Thanks in advance for helping me to understand!

Outcomes