<?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: Varianble Name function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199413#M15322</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I want to loop through P and then return T R S, not 1 2 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for x in P&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename = " XYZ " + T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The desired output is XYZT not XYZ1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is that possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Sep 2014 07:33:33 GMT</pubDate>
    <dc:creator>MittRamgobin</dc:creator>
    <dc:date>2014-09-25T07:33:33Z</dc:date>
    <item>
      <title>Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199411#M15320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a function that returns the name of the variable rather than its contents.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;T = 1&lt;/P&gt;&lt;P&gt;R= 2&lt;/P&gt;&lt;P&gt;S= 3&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P = (T, R, S)&lt;/P&gt;&lt;P&gt;Is there a fucntion that if I do function(T) it will return T?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 06:54:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199411#M15320</guid>
      <dc:creator>MittRamgobin</dc:creator>
      <dc:date>2014-09-25T06:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199412#M15321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you explain what you are trying to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you do after P = (T,R,S)?&lt;/P&gt;&lt;P&gt;P[0] and P[T-1] will both return 1.&lt;/P&gt;&lt;P&gt;eval("T") will also return 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 07:07:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199412#M15321</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-25T07:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199413#M15322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I want to loop through P and then return T R S, not 1 2 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for x in P&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename = " XYZ " + T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The desired output is XYZT not XYZ1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is that possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 07:33:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199413#M15322</guid>
      <dc:creator>MittRamgobin</dc:creator>
      <dc:date>2014-09-25T07:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199414#M15323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could create another list:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P1 = ["T","R","S"]&lt;/P&gt;&lt;P&gt;filename = "XYZ" + P1[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe a dictionary?&lt;/P&gt;&lt;P&gt;D = {1:"T", 2: "R", 3: "S"}&lt;/P&gt;&lt;P&gt;D[1] is "T"&lt;/P&gt;&lt;P&gt;if T == 1, D&lt;T&gt; is "T"&lt;/T&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 07:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199414#M15323</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-25T07:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199415#M15324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import sys&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;# Script to create LGA Map with WP Infrastructure&lt;/P&gt;&lt;P&gt;# Define variables&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = r"C:\Users\N041871\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\DynamicCredentials@GISR.sde"&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;#LGA = arcpy.GetParameterAsText(0) # Input Required Local Government Area&lt;BR /&gt;LGA ="COOROW, SHIRE OF"&lt;BR /&gt;LGA2 = "COOROW"&lt;/P&gt;&lt;P&gt;#Define Layers to Intersect&lt;/P&gt;&lt;P&gt;#1. Transmission Layers&lt;BR /&gt;T330OH = arcpy.ListFeatureClasses("GISTRAN.Trans_330kV_OH_Carrier","All","GISTRAN.Transmission")&lt;BR /&gt;T330UG = arcpy.ListFeatureClasses("GISTRAN.Trans_330kV_UG_Cable","All","GISTRAN.Transmission")&lt;BR /&gt;T220OV = arcpy.ListFeatureClasses("GISTRAN.Trans_220kV_OH_Carrier","All","GISTRAN.Transmission")&lt;BR /&gt;T132OH = r"C:\Users\N041871\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\DynamicCredentials@GISR.sde\GISTRAN.Transmission\GISTRAN.Trans_132kV_OH_Carrier"&lt;BR /&gt;T132UG = arcpy.ListFeatureClasses("GISTRAN.Trans_132kV_UG_Cable","All","GISTRAN.Transmission")&lt;BR /&gt;T66OV = arcpy.ListFeatureClasses("GISTRAN.Trans_66kV_OH_Carrier","All","GISTRAN.Transmission")&lt;BR /&gt;T66UG = arcpy.ListFeatureClasses("GISTRAN.Trans_66kV_UG_Cable","All","GISTRAN.Transmission")&lt;BR /&gt;T33OH = arcpy.ListFeatureClasses("GISTRAN.Trans_33kV_OH_Carrier","All","GISTRAN.Transmission")&lt;BR /&gt;T33UG = arcpy.ListFeatureClasses("GISTRAN.Trans_33kV_UG_Cable","All","GISTRAN.Transmission")&lt;BR /&gt;TransStruc = arcpy.ListFeatureClasses("GISTRAN.Trans_Structure","All","GISTRAN.Transmission")&lt;BR /&gt;Substation = arcpy.ListFeatureClasses("GISTRAN.Substation","All","GISTRAN.Transmission")&lt;BR /&gt;#Group Transmission Values:&lt;BR /&gt;Transmission = (T330OH, T330UG, T220OV, T132OH, T132UG, T66OV, T66UG, T33OH, T33UG, TransStruc, Substation)&lt;BR /&gt; &lt;BR /&gt;&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;&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; &lt;BR /&gt;#Select Required LGA&lt;BR /&gt;arcpy.MakeFeatureLayer_management("GISEXT.Local_Government_Authority", "LGAlyr")&lt;BR /&gt;fieldName = "NAME"&lt;BR /&gt;Query = "\""+fieldName+"\"='"+LGA+"'"&lt;BR /&gt;arcpy.SelectLayerByAttribute_management ("LGAlyr", "NEW_SELECTION", Query)&lt;BR /&gt;###arcpy.SelectLayerByAttribute_management ("LGAlyr", "NEW_SELECTION", """ "NAME" = 'ALBANY, CITY OF' """) - working code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for Struc in Transmission:&lt;BR /&gt;outputPath = r"S:\SupportServices\LGAShapefiles"&lt;BR /&gt;basefileName = str(LGA2)+str(Struc))&lt;BR /&gt;fileFormat= '.shp'&lt;BR /&gt;finalDest = os.path.join(outputPath,basefileName+fileFormat)&lt;BR /&gt;#print Struc&lt;/P&gt;&lt;P&gt;arcpy.Clip_analysis(T132OH, "LGAlyr",finalDest)&lt;BR /&gt;#arcpy.Clip_analysis(Struc,"LGAlyr", finalDest)&lt;/P&gt;&lt;P&gt;print "Process ended"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the last loop I want to use the variable name to name the output file and the variable content for geoprocessing....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is that possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 07:49:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199415#M15324</guid>
      <dc:creator>MittRamgobin</dc:creator>
      <dc:date>2014-09-25T07:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199416#M15325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please see &lt;A href="https://community.esri.com/migration-blogpost/1070" target="_blank"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggested change, use a list, and create a list of labels in the same order:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Transmission = [T330OH, T330UG, T220OV, T132OH, T132UG, T66OV, T66UG, T33OH, T33UG, TransStruc, Substation]&lt;/SPAN&gt;


&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;TransLabels = ["&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;T330OH&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&lt;/SPAN&gt;, &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&lt;/SPAN&gt;T330UG&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&lt;/SPAN&gt;, "T220OV&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&lt;/SPAN&gt;, &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&lt;/SPAN&gt;T132OH&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&lt;/SPAN&gt;&amp;nbsp; (etc)&lt;/SPAN&gt;&lt;/SPAN&gt;




&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Then at the end:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;k = 0&lt;/SPAN&gt;


for Struc in Transmission:
&amp;nbsp;&amp;nbsp;&amp;nbsp; outputPath = r"S:\SupportServices\LGAShapefiles"
&amp;nbsp;&amp;nbsp;&amp;nbsp; basefileName = str(LGA2)+str(Struc))
&amp;nbsp;&amp;nbsp;&amp;nbsp; fileFormat= '.shp'
&amp;nbsp;&amp;nbsp;&amp;nbsp; finalDest = os.path.join(outputPath,basefileName+Translabels&lt;K&gt; + fileFormat)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_analysis(Struc,"LGAlyr", finalDest)&lt;/K&gt;


&amp;nbsp;&amp;nbsp;&amp;nbsp; k += 1


print "Process ended"




&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An unrelated comment, you seem to be using ListFeatureClasses (which returns a list) when you really want a path to a single dataset:&lt;/P&gt;&lt;P&gt;maybe instead of&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;T330OH = arcpy.ListFeatureClasses("GISTRAN.Trans_330kV_OH_Carrier",&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;"All","GISTRAN.Transmission")&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;you mean:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;T330OH = os.path.join("GISTRAN.Transmission", "GISTRAN.Trans_330kV_OH_Carrier")&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:56:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199416#M15325</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T09:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199417#M15326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Curtis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked and yes if did figure the path thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 08:58:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199417#M15326</guid>
      <dc:creator>MittRamgobin</dc:creator>
      <dc:date>2014-09-25T08:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199418#M15327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have another issue. I want to delete all empty shapefiles in a folder. The following is not working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14116358258492421 jive_text_macro" jivemacro_uid="_14116358258492421"&gt;
&lt;P&gt;#Find empty shapefiles and delete them&lt;/P&gt;
&lt;P&gt;arcpy.env.workspace = r"S:\SupportServices\LGAShapefiles"&lt;/P&gt;
&lt;P&gt;shapefiles = arcpy.ListFeatureClasses()&lt;/P&gt;
&lt;P&gt;for shapefile in shapefiles:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.management.GetCount(shapefile)[0]=="0":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(shapefile)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print shapefile + "Deleted"&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 09:03:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199418#M15327</guid>
      <dc:creator>MittRamgobin</dc:creator>
      <dc:date>2014-09-25T09:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199419#M15328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GetCount doesn't return a number, it returns a result object. This is documented in the help for the tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14116592480754222" jivemacro_uid="_14116592480754222"&gt;
&lt;P&gt;if str(arcpy.management.GetCount(shapefile))=="0":&lt;/P&gt;
&lt;P&gt;# or (both will work)&lt;/P&gt;
&lt;P&gt;if arcpy.management.GetCount(shapefile).getOutput(0)=="0":&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 15:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199419#M15328</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-25T15:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199420#M15329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 000732: Input Rows: Dataset GISTRAN.SubstationCOOROW, SHIRE OF.shp does not exist or is not supported&lt;/P&gt;&lt;P&gt;Failed to execute (GetCount).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 00:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199420#M15329</guid>
      <dc:creator>MittRamgobin</dc:creator>
      <dc:date>2014-09-26T00:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Varianble Name function</title>
      <link>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199421#M15330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the error message true?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 03:43:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/varianble-name-function/m-p/199421#M15330</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-26T03:43:41Z</dc:date>
    </item>
  </channel>
</rss>

