<?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 Python code block in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-code-block/m-p/1153580#M64050</link>
    <description />
    <pubDate>Mon, 14 Mar 2022 23:02:50 GMT</pubDate>
    <dc:creator>JoshaAnderson</dc:creator>
    <dc:date>2022-03-14T23:02:50Z</dc:date>
    <item>
      <title>Python code block</title>
      <link>https://community.esri.com/t5/python-questions/python-code-block/m-p/1153580#M64050</link>
      <description />
      <pubDate>Mon, 14 Mar 2022 23:02:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code-block/m-p/1153580#M64050</guid>
      <dc:creator>JoshaAnderson</dc:creator>
      <dc:date>2022-03-14T23:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python code block</title>
      <link>https://community.esri.com/t5/python-questions/python-code-block/m-p/1153585#M64052</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want write a python code block using " geoprocessing calculate field that adds a text field to the roads.shp feature class called FERRY. This new field should be populated with values of YES and NO depending on the value of the FEATURE field. If the value of the FEATURE field is ‘Ferry Crossing’, the value of the FERRY field should be YES – otherwise the value of the&lt;BR /&gt;FERRY field should be NO.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if this is a field calculation, with "a" containing the data and "b" being updated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def calc(a):
    """ """
    if a == "Ferry Crossing":
        return "YES"
    return "NO"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;python parser&lt;/P&gt;&lt;P&gt;expression calculating into field "b"&lt;/P&gt;&lt;P&gt;calc(!a!)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where the field name (a) is enclosed in !&lt;/P&gt;&lt;P&gt;You can use this code block and expression in CalculateField&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 10:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code-block/m-p/1153585#M64052</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-03-15T10:26:14Z</dc:date>
    </item>
  </channel>
</rss>

