<?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: GetParameterAsText using 'r' like raw strings? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272739#M21065</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you ever figure this out?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;The answer is to&amp;nbsp;quote the strings in the expression.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;If you're having trouble, put some more detail (i.e some code would be good) in about your input values and how you construct the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Also, don't parse paths with&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;.split("\")&lt;/SPAN&gt;... Use &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;os.path.split(your_file_path)&lt;/SPAN&gt; which will handle all the slash permutations for you.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jul 2018 00:54:34 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2018-07-06T00:54:34Z</dc:date>
    <item>
      <title>GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272735#M21061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've looked everywhere I can think of for a solution, or at least similar problem, to this but can't find one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script gets a user entered value via GetParameterAsText(0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The value normally contains '-' characters, a typical one taking the form Z-FY-12-34, for example. When I try to set a text field to this value, CalculateField apparently treats the value as a number, subtracting the numbers and discarding the letters; the value then gets set to something like -46. I'm not sure it actually subtracts, but it always returns a - followed by a number. Whenever I check the value in the script, it looks correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm guessing that maybe this is related to using r to accept a raw string, but I don't know how to do that with GetParameter..., and maybe that's not the actual problem anyway. Any ideas on what the cause is and how to fix it? Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;case_number = arcpy.GetParameterAsText(0)&amp;nbsp;&amp;nbsp; # user enters Z-FY-12-34 . . .&amp;nbsp; fc = "Cases" &amp;nbsp;&amp;nbsp;&amp;nbsp; fld = "Case_"&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Adding Case number " + case_number + " added.")&amp;nbsp;&amp;nbsp; # case_number = Z-FY-12-34&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(fc, fld, case_number)&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;&amp;nbsp;&amp;nbsp; # field value set at -124 or some other number &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Case number " + case_number + " added.")&amp;nbsp;&amp;nbsp; # case_number = Z-FY-12-34 &amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as e: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError("Error setting Case_ field value to case number. \n" + e.message)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 18:19:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272735#M21061</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2012-04-05T18:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272736#M21062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, raw strings only apply to string literals not string variables.&amp;nbsp; You just need to quote your expression as you would entering it manually in the field calculator:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.CalculateField_management(fc, fld, '"'+case_number+'"') #Or arcpy.CalculateField_management(fc, fld, '"%s"' % case_number)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 19:27:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272736#M21062</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2012-04-05T19:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272737#M21063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks. I didn't think that would be necessary using the variable from a parameter, but very helpful to know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2012 01:55:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272737#M21063</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2012-04-06T01:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272738#M21064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever figure this out?&amp;nbsp; I am trying to use&amp;nbsp;&lt;SPAN style="font-size: 11.0pt;"&gt;arcpy.CalculateField_management to add the filepath and filename to a field and if the folder begins with a number, it distorts the name. For example a portion of the file path might look like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;...\Date\Client\180705\1_Event\Point.shp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;will look like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;&lt;SPAN&gt;...\Date\Client&amp;nbsp; &amp;nbsp;180705&amp;nbsp; @_Event\Point.shp&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;&lt;SPAN&gt;I will want do calculations in other fields based on these values using the .split("\") function, so it's important that I get the complete, correct filepath.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2018 17:34:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272738#M21064</guid>
      <dc:creator>KariBuckvold</dc:creator>
      <dc:date>2018-07-05T17:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272739#M21065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you ever figure this out?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;The answer is to&amp;nbsp;quote the strings in the expression.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;If you're having trouble, put some more detail (i.e some code would be good) in about your input values and how you construct the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Also, don't parse paths with&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;.split("\")&lt;/SPAN&gt;... Use &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;os.path.split(your_file_path)&lt;/SPAN&gt; which will handle all the slash permutations for you.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2018 00:54:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272739#M21065</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2018-07-06T00:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272740#M21066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what the code looks like (not sure how to add to this as a code sample, just as text.)&amp;nbsp; I've also tried adding an "r" in various forms in the CalculateField line, to no avail.&amp;nbsp;When using the print function for the fc, the filepath/name appears as it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parsing with the .split("\") was for a later field calculator expression, but mentioned because&amp;nbsp;to indicate that it is important that the file path be exact.&amp;nbsp;&amp;nbsp;&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;for&lt;/SPAN&gt; dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; dirnames&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filenames &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; walk&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; filename &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; filenames&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fcs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; fc
&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Source'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'"'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; fc &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'"'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PYTHON"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:19:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272740#M21066</guid>
      <dc:creator>KariBuckvold</dc:creator>
      <dc:date>2021-12-11T13:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272741#M21067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Source'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'r"'&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;+&lt;/SPAN&gt; fc &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;+&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'"'&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"PYTHON"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2018 00:42:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272741#M21067</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2018-07-07T00:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272742#M21068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;string split with backslashes need to be escaped ie "\\"&lt;/P&gt;&lt;P&gt;the differences are as in the example&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;win_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'C:\\GIS\\A_Tools_scripts\\Polygon_lineTools\\Scripts\\arcpytools_plt.py'&lt;/SPAN&gt;

win_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&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;

&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'C:'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'GIS'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'A_Tools_scripts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Polygon_lineTools'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'Scripts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="string token"&gt;'arcpytools_plt.py'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;win_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'C:\\GIS\\A_Tools_scripts\\Polygon_lineTools\\Scripts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'arcpytools_plt.py'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&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;/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>Sat, 11 Dec 2021 13:19:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272742#M21068</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T13:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272743#M21069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that. was. it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, I was pounding my head against the wall on that one!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2018 01:05:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272743#M21069</guid>
      <dc:creator>KariBuckvold</dc:creator>
      <dc:date>2018-07-07T01:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText using 'r' like raw strings?</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272744#M21070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What you (and lots of others) were probably struggling with is you need to construct a valid python expression&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;inside&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;a python string, not as an actual python expression&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;For example, say you wan&lt;/SPAN&gt;ted to calculate a&amp;nbsp;string field to be&amp;nbsp;something like r"A:\B\D.d", if you passed that to arcpy.CalculateField_management, the tool would only see&amp;nbsp;&lt;SPAN&gt;A:\B\D.d which is not valid python (it's not quoted) and the backslashes wouldn't be escaped.&amp;nbsp; You&amp;nbsp;&lt;/SPAN&gt;would construct your expression as r'r"&lt;SPAN&gt;A:\B\D.d"'. There's a few ways to make this easier to get your head around with string formatting.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In simple terms, think about what you need to have valid python syntax,&amp;nbsp;&lt;EM&gt;then&lt;/EM&gt; wrap all that in quotes to make a string.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2018 02:20:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-using-r-like-raw-strings/m-p/272744#M21070</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2018-07-07T02:20:56Z</dc:date>
    </item>
  </channel>
</rss>

