<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Print Out And Change Layer Labels With ArcPy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238214#M18539</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To emulate what you describe doing in the GUI, look into the labelClasses property of a layer object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 May 2017 20:32:17 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2017-05-16T20:32:17Z</dc:date>
    <item>
      <title>Print Out And Change Layer Labels With ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238211#M18536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to change the way my labels are displayed in ArcMap using ArcPy. I want to replace &lt;SPAN&gt;underscores with spaces in&lt;/SPAN&gt;&amp;nbsp;label strings with using&lt;STRONG&gt; string.replace("_"," ")&lt;/STRONG&gt;. I have SHOWLABELS set to True, but I'm having trouble accessing the label values themselves in ArcPy. Looking in the LabelClass documentation, I can't find any method to print out or alter the label values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;city_layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"cities"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
countries_layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"countries"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; city_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"SHOWLABELS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; city_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;showLabels &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; countries_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;supports&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"SHOWLABELS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; countries_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;showLabels &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238211#M18536</guid>
      <dc:creator>LloydBronn</dc:creator>
      <dc:date>2021-12-11T12:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Print Out And Change Layer Labels With ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238212#M18537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean the layer name in the TOC, which some people loosely call label, or do you mean labels of features in the map.&amp;nbsp; Labels of features are typically driven by data, either directly or through expressions.&amp;nbsp; If some text in a field is being used to label a feature, and that text has the underscore, then updating the text is the way to go.&amp;nbsp; If an expression is inserting the underscore, then modifying the expression is the way to go.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 20:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238212#M18537</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-05-16T20:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Print Out And Change Layer Labels With ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238213#M18538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I just went in to the MXD and changed the label expression there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 20:22:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238213#M18538</guid>
      <dc:creator>LloydBronn</dc:creator>
      <dc:date>2017-05-16T20:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Print Out And Change Layer Labels With ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238214#M18539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To emulate what you describe doing in the GUI, look into the labelClasses property of a layer object.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 20:32:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238214#M18539</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-05-16T20:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Print Out And Change Layer Labels With ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238215#M18540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Will do, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 20:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/print-out-and-change-layer-labels-with-arcpy/m-p/238215#M18540</guid>
      <dc:creator>LloydBronn</dc:creator>
      <dc:date>2017-05-16T20:44:42Z</dc:date>
    </item>
  </channel>
</rss>

