<?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: How to save layer files and ignore special characters using python? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714273#M55413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm hoping there is a way to edit the script so that it will ignore special characters when naming the new .lyr files. My mxd contains over 100 different layers so manually changing the layer names to remove any special characters would be extremely time consuming. Some symbols, like the copyright symbol, are also quite important so would only like them removed in the file name, not the layer name.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Apr 2019 22:26:24 GMT</pubDate>
    <dc:creator>Anneka_France</dc:creator>
    <dc:date>2019-04-30T22:26:24Z</dc:date>
    <item>
      <title>How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714271#M55411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to save all layers in my mxd as .lyr files using the script below. However, I'm getting an error because some layer names contain special characters (e.g. © : * )&amp;nbsp; and cannot be written into file names. How can I make sure special characters are ignored/replaced?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: 16px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class="" start="1" style="color: #5c5c5c; background-color: #ffffff; border: none; font-size: 12px; margin: 0px 0px 1px 45px !important;"&gt;&lt;LI class="" style="color: inherit; background-color: #ffffff; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;import&lt;/SPAN&gt;&amp;nbsp;os&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: #5c5c5c; background-color: #f6f6f6; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;basepath&amp;nbsp;=&amp;nbsp;r&lt;SPAN class="" style="color: blue; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;'C:\Users\Anneka\CaBA_Data_Phase_5\Layers'&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: inherit; background-color: #ffffff; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;mxd&amp;nbsp;=&amp;nbsp;arcpy.mapping.MapDocument(&lt;SPAN class="" style="color: blue; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;"CURRENT"&lt;/SPAN&gt;)&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: #5c5c5c; background-color: #f6f6f6; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;for&lt;/SPAN&gt;&amp;nbsp;lyr&amp;nbsp;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;in&lt;/SPAN&gt;&amp;nbsp;arcpy.mapping.ListLayers(mxd):&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: inherit; background-color: #ffffff; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;if&lt;/SPAN&gt;&amp;nbsp;lyr.isGroupLayer&amp;nbsp;==&amp;nbsp;&lt;SPAN class="" style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;True&lt;/SPAN&gt;:&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: #5c5c5c; background-color: #f6f6f6; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;grpPath&amp;nbsp;=&amp;nbsp;os.path.join(basepath,&amp;nbsp;str(lyr))&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: inherit; background-color: #ffffff; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;if&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;not&lt;/SPAN&gt;&amp;nbsp;os.path.exists(grpPath):&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: #5c5c5c; background-color: #f6f6f6; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;os.makedirs(grpPath)&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: inherit; background-color: #ffffff; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;else&lt;/SPAN&gt;:&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: #5c5c5c; background-color: #f6f6f6; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fn&amp;nbsp;=&amp;nbsp;os.path.join(basepath,&amp;nbsp;str(lyr)&amp;nbsp;+&amp;nbsp;&lt;SPAN class="" style="color: blue; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;".lyr"&lt;/SPAN&gt;)&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: inherit; background-color: #ffffff; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lyr.saveACopy(fn)&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="" style="color: #5c5c5c; background-color: #f6f6f6; border-top: none; border-bottom: none; border-left: 3px solid #6ce26c; border-right: none; font-weight: inherit; font-size: 12px; margin: 0px !important; padding: 0px 3px 0px 10px !important;"&gt;&lt;SPAN style="color: black; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="" style="color: #0088e1; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;print&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="" style="color: blue; background-color: inherit; border: 0px; font-weight: inherit; font-size: 9pt !important;"&gt;"Saved:&amp;nbsp;"&lt;/SPAN&gt;&amp;nbsp;+&amp;nbsp;fn&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 21:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714271#M55411</guid>
      <dc:creator>Anneka_France</dc:creator>
      <dc:date>2019-04-30T21:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714272#M55412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can't you just rename them in the table of contents sans the special characters?&amp;nbsp; I did it and go this result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
mxd &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;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&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="punctuation token"&gt;:&lt;/SPAN&gt;  
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name

&lt;SPAN class="string token"&gt;'''' returns :    
Bonneville_Shoreline_Trail
RegionalTrails_1
Trails'''&lt;/SPAN&gt;'

&lt;SPAN class="string token"&gt;''' name change'''&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&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="punctuation token"&gt;:&lt;/SPAN&gt;  
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name
&lt;SPAN class="string token"&gt;''' returns:
     
BonnevilleShorelineTrail  &amp;lt;- note name change
RegionalTrails_1
Trails
'''&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;/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;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714272#M55412</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-12T06:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714273#M55413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm hoping there is a way to edit the script so that it will ignore special characters when naming the new .lyr files. My mxd contains over 100 different layers so manually changing the layer names to remove any special characters would be extremely time consuming. Some symbols, like the copyright symbol, are also quite important so would only like them removed in the file name, not the layer name.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 22:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714273#M55413</guid>
      <dc:creator>Anneka_France</dc:creator>
      <dc:date>2019-04-30T22:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714274#M55414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/validatetablename.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/validatetablename.htm"&gt;ValidateTableName—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;.&amp;nbsp; If you don't pass a workspace, it will simply validate the name you pass it.&amp;nbsp; By the way, the copyright symbol is valid, so it should not be throwing an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2019 22:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714274#M55414</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-04-30T22:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714275#M55415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right, the problem wasn't with the file names. Problem is you can't have special characters in folder names so&amp;nbsp;it's still throwing an error when it comes across a group with special characters...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2019 10:20:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714275#M55415</guid>
      <dc:creator>Anneka_France</dc:creator>
      <dc:date>2019-05-01T10:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714276#M55416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IMHO special characters are worse than under cooked hash browns.&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;Here's another example of how they can spoil an oherwise perfect day&amp;nbsp;&lt;A href="https://community.esri.com/thread/232565-mystery-with-excel-files"&gt;https://community.esri.com/thread/232565-mystery-with-excel-files&lt;/A&gt;&amp;nbsp;....&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2019 12:14:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714276#M55416</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-05-01T12:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714277#M55417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anneka…&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/filenames-and-file-paths-in-python"&gt;/blogs/dan_patterson/2016/08/14/filenames-and-file-paths-in-python&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;especially in the world of python 3 and&amp;nbsp; Unicode, many traps abound&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2019 12:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714277#M55417</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-05-01T12:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to save layer files and ignore special characters using python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714278#M55418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See if using this regular expression works for you (adapted from &lt;A class="link-titled" href="https://stackoverflow.com/questions/1033424/how-to-remove-bad-path-characters-in-python" title="https://stackoverflow.com/questions/1033424/how-to-remove-bad-path-characters-in-python" rel="nofollow noopener noreferrer" target="_blank"&gt;How to remove bad path characters in Python? - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; re
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; pattern &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'[^:\\\ \w\-_\.]'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; bad_lyr_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\tmp\esri©\layers,mxds\mylayer.lyr"&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;re&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sub&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pattern&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; bad_lyr_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\tmp\esri_\layers_mxds\mylayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;lyr
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:35:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-save-layer-files-and-ignore-special/m-p/714278#M55418</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T06:35:08Z</dc:date>
    </item>
  </channel>
</rss>

