<?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 String Parameter in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/string-parameter/m-p/477905#M37414</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got a simple script with a single parameter of type string. The script does a field calculate of the entered value into a field of type string. Here's the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
s = arcpy.GetParameterAsText(0)

arcpy.AddMessage(type(s)) # displays type as 'unicode'

for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.isFeatureLayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(lyr,"myfield",s)

del mxd
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the script, I have to wrap the input value in double quotes for it to work. I would have thought that wasn't needed since the parameter is of type string, and the parameter is brought in using GetParameterAsText. Is there some setting I'm missing that's causing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 03 Dec 2011 01:56:30 GMT</pubDate>
    <dc:creator>ScottOatley</dc:creator>
    <dc:date>2011-12-03T01:56:30Z</dc:date>
    <item>
      <title>String Parameter</title>
      <link>https://community.esri.com/t5/python-questions/string-parameter/m-p/477905#M37414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got a simple script with a single parameter of type string. The script does a field calculate of the entered value into a field of type string. Here's the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
s = arcpy.GetParameterAsText(0)

arcpy.AddMessage(type(s)) # displays type as 'unicode'

for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.isFeatureLayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(lyr,"myfield",s)

del mxd
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the script, I have to wrap the input value in double quotes for it to work. I would have thought that wasn't needed since the parameter is of type string, and the parameter is brought in using GetParameterAsText. Is there some setting I'm missing that's causing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Dec 2011 01:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/string-parameter/m-p/477905#M37414</guid>
      <dc:creator>ScottOatley</dc:creator>
      <dc:date>2011-12-03T01:56:30Z</dc:date>
    </item>
  </channel>
</rss>

