In the script I'm running, each time the process runs, the output will have the same name as the output from the previous run of the process, and the previous output will be overwritten. how I can avoid overwriting previous outputs in successive iterations by appending the name of the output followed by the number of iteration, which will give each output a unique name that indicates its position in the list of inputs. I tried using the %i% system variable with in-line variable substitution as its shown in the script, but it seems that %i% just working within the Arcmap model-builder.
Here I'm sharing the script with you, and the list I used.
import arcpy
with open('D:\\referencedata\\fishnet\\listtest.txt', 'r') as coordinate:
for line in coordinate:
# Local variables:
Input = "D:\\referencedata\\Menderes_1KM_MPI-RF_19710101-20051030.nc"
NetCDFLayerName = "Menderes_1KM_MPI-RF_19710101%i%"
Output__xls = "D:\\referencedata\\fishnet\\table\\Menderes_1KM_MPI-RF_19710101_%i%.xls"
# Process: Make NetCDF Table View
arcpy.MakeNetCDFTableView_md(Input, "pr;tas;tasmax;tasmin;sfcWind;hurs;rsns", NetCDFLayerName, "time", line, "BY_VALUE")
# Process: Table To Excel
arcpy.TableToExcel_conversion(NetCDFLayerName, Output__xls, "ALIAS", "CODE")
<SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: 13px; margin: 0px;"></SPAN>the list looks like this;
jx -53000;iy -33000
jx -52000;iy -33000
jx -51000;iy -33000