Skip to main content

You are referring to the variables by starting iterating items in your code before you actually declare the variables.

The correct syntax would be:

#Import arcpy module
import arcpy

# Local variables:
a =A ['Water'=['FL_RechargeArea','Hiking''FL_AquiferProtectionArea','Biking''FL_AreaofContribution','Ski']'GA_RechargeArea','GA_AquiferProtectionArea','GA_AreaofContribution']
bB = "COUNTY""STATE"
New_Shapefile = "\\\\My Documents\\ArcGIS\\"+COUNTY+"Documents\\ArcGIS\\"+STATE+".shp"
Output_from_NewOutput_from_New_Shapefile = "\\\\My Documents\\ArcGIS\\"+COUNTY+"2Documents\\NewFolder\\"+STATE+"2.shp"

for aA in bB:
    # Process: Copy Features
    arcpy.CopyFeatures_management(New_Shapefile, Output_from_NewOutput_from_New_Shapefile, "", "0", "0", "0")

Another thing is that you want to give your variable names that make sense. Please refer to the Python PEP-8 style guide.

Your script however will not copy any shapefiles by using the a and b variables because you don't use them in the code. You probably want to use str.format() method to insert the variable values in the output shapefile name. Look for some example on using the str.format() code here and in the Esri Help.

You are referring to the variables by starting iterating items in your code before you actually declare the variables.

The correct syntax would be:

#Import arcpy module
import arcpy

# Local variables:
a = ['Water','Hiking','Biking','Ski']
b = "COUNTY"
New_Shapefile = "\\\\My Documents\\ArcGIS\\"+COUNTY+".shp"
Output_from_New = "\\\\My Documents\\ArcGIS\\"+COUNTY+"2.shp"

for a in b:
    # Process: Copy Features
    arcpy.CopyFeatures_management(New_Shapefile, Output_from_New, "", "0", "0", "0")

Another thing is that you want to give your variable names that make sense. Please refer to the Python PEP-8 style guide.

Your script however will not copy any shapefiles by using the a and b variables because you don't use them in the code. You probably want to use str.format() method to insert the variable values in the output shapefile name. Look for some example on using the str.format() code here and in the Esri Help.

You are referring to the variables by starting iterating items in your code before you actually declare the variables.

The correct syntax would be:

#Import arcpy module
import arcpy

# Local variables:
A =['FL_RechargeArea','FL_AquiferProtectionArea','FL_AreaofContribution','GA_RechargeArea','GA_AquiferProtectionArea','GA_AreaofContribution']
B = "STATE"
New_Shapefile = "\\\\My Documents\\ArcGIS\\"+STATE+".shp"
Output_from_New_Shapefile = "\\\\My Documents\\NewFolder\\"+STATE+"2.shp"

for A in B:
    # Process: Copy Features
    arcpy.CopyFeatures_management(New_Shapefile, Output_from_New_Shapefile, "", "0", "0", "0")

Another thing is that you want to give your variable names that make sense. Please refer to the Python PEP-8 style guide.

Your script however will not copy any shapefiles by using the a and b variables because you don't use them in the code. You probably want to use str.format() method to insert the variable values in the output shapefile name. Look for some example on using the str.format() code here and in the Esri Help.

Source Link
Alex Tereshenkov
  • 30k
  • 4
  • 54
  • 119

You are referring to the variables by starting iterating items in your code before you actually declare the variables.

The correct syntax would be:

#Import arcpy module
import arcpy

# Local variables:
a = ['Water','Hiking','Biking','Ski']
b = "COUNTY"
New_Shapefile = "\\\\My Documents\\ArcGIS\\"+COUNTY+".shp"
Output_from_New = "\\\\My Documents\\ArcGIS\\"+COUNTY+"2.shp"

for a in b:
    # Process: Copy Features
    arcpy.CopyFeatures_management(New_Shapefile, Output_from_New, "", "0", "0", "0")

Another thing is that you want to give your variable names that make sense. Please refer to the Python PEP-8 style guide.

Your script however will not copy any shapefiles by using the a and b variables because you don't use them in the code. You probably want to use str.format() method to insert the variable values in the output shapefile name. Look for some example on using the str.format() code here and in the Esri Help.