<?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: ArcGIS 10.2 - Proper syntax in Python to print integer? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293766#M22728</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. It works very well. As long as variable &lt;SPAN style="font-family: courier new,courier;"&gt;id&lt;/SPAN&gt; is a number (integer or float) and not a string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I used the former 9.3 syntax because this script was initially made at that time and I haven't upgraded the code to arcpy...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Nov 2015 08:31:37 GMT</pubDate>
    <dc:creator>VincentLaunstorfer</dc:creator>
    <dc:date>2015-11-27T08:31:37Z</dc:date>
    <item>
      <title>ArcGIS 10.2 - Proper syntax in Python to print integer?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293764#M22726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks perhaps simple, but I am looking for the proper syntax in Python in order to print integer field correctly when running a script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the time being, I get:&lt;/P&gt;&lt;P&gt;ID:1.0000080689e+11&lt;/P&gt;&lt;P&gt;with: &lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1448524180260949 jive_text_macro" data-renderedposition="155_8_912_16" jivemacro_uid="_1448524180260949"&gt;&lt;P&gt;gp.AddMessage("ID:" + str(input_text))&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I would prefer the proper integer value... What would be the syntax to format it correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Nov 2015 07:51:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293764#M22726</guid>
      <dc:creator>VincentLaunstorfer</dc:creator>
      <dc:date>2015-11-26T07:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.2 - Proper syntax in Python to print integer?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293765#M22727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I highly recommend getting familiar with &lt;A href="https://docs.python.org/2/library/string.html#format-specification-mini-language" rel="nofollow noopener noreferrer" target="_blank"&gt;Python string formatting. &lt;/A&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;id = 1.0000080689e+11
# gives you the same result
gp.AddMessage("ID: {}".format(id))&amp;nbsp; 
# will display as a number with no decimals
gp.AddMessage("ID: {:.0f}".format(id)) 
# or show off and add commas
gp.AddMessage("ID: {:,.0f}".format(id))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unless you have a really good reason to use gp (for example, you want to write code that is backwards-compatible to 9.3), I highly recommend using arcpy instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293765#M22727</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T14:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.2 - Proper syntax in Python to print integer?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293766#M22728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. It works very well. As long as variable &lt;SPAN style="font-family: courier new,courier;"&gt;id&lt;/SPAN&gt; is a number (integer or float) and not a string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I used the former 9.3 syntax because this script was initially made at that time and I haven't upgraded the code to arcpy...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2015 08:31:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-2-proper-syntax-in-python-to-print/m-p/293766#M22728</guid>
      <dc:creator>VincentLaunstorfer</dc:creator>
      <dc:date>2015-11-27T08:31:37Z</dc:date>
    </item>
  </channel>
</rss>

