<?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: Python Calculate Field Management String Variable Formatting in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133970#M10475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found a work around, but it doesn't solve the question of formatting.&amp;nbsp; If I change the variable to have double quotes it accepts it.&amp;nbsp; I have to format the variable with the quotation marks wrapped in triple apostrophes, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;cName = '''"{&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5;"&gt;0}"'''.format(tName)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Sep 2014 15:23:57 GMT</pubDate>
    <dc:creator>GeoffOlson</dc:creator>
    <dc:date>2014-09-24T15:23:57Z</dc:date>
    <item>
      <title>Python Calculate Field Management String Variable Formatting</title>
      <link>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133969#M10474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to calculate a field using the Python window, but I can't seem to figure out how to format the function properly.&amp;nbsp; What's the correct syntax for using a string variable as the expression?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="python" name="code"&gt;arcpy.CalculateField_management(mapLyr2, "Jurisdicti", "'{0}'.format(tName)", "PYTHON")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't find an example that answered this question for me.&amp;nbsp; Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 15:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133969#M10474</guid>
      <dc:creator>GeoffOlson</dc:creator>
      <dc:date>2014-09-24T15:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python Calculate Field Management String Variable Formatting</title>
      <link>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133970#M10475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found a work around, but it doesn't solve the question of formatting.&amp;nbsp; If I change the variable to have double quotes it accepts it.&amp;nbsp; I have to format the variable with the quotation marks wrapped in triple apostrophes, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;cName = '''"{&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5;"&gt;0}"'''.format(tName)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 15:23:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133970#M10475</guid>
      <dc:creator>GeoffOlson</dc:creator>
      <dc:date>2014-09-24T15:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python Calculate Field Management String Variable Formatting</title>
      <link>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133971#M10476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeoff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.CalculateField_management(&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12.222222328186px;"&gt;mapLyr2&lt;/SPAN&gt;, "&lt;SPAN style="color: #0000ff; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12.222222328186px;"&gt;Jurisdicti&lt;/SPAN&gt;", "\"{0}\"".format(tName), "PYTHON")&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 15:46:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-calculate-field-management-string-variable/m-p/133971#M10476</guid>
      <dc:creator>RiyasDeen</dc:creator>
      <dc:date>2014-09-24T15:46:12Z</dc:date>
    </item>
  </channel>
</rss>

