Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

print arcpy.mapping.ListLayers confusion

$
0
0
Hi. I'm a little confused and I want to understand this better.

If I enter:

Code:

arcpy.mapping.ListLayers(mxd)[0]
...the python console returns <map layer u'A'>

If I enter:

Code:

print arcpy.mapping.ListLayers(mxd)[0]
...the console returns just the layer name, A

However, if I use slice notation as follows:

Code:

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!

Viewing all articles
Browse latest Browse all 2485

Trending Articles