Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

add value to result of calculation of the filed

$
0
0
I need to put in filed path + filed_value.
filed value I calculate with next script:

Code:

import arcpy
input_based_on_raster = "C:\\1\\2\\fr_kv1_05002_05000_01_3np2_08_t_pss1_034412_180613_raster_reclass.shp"
arcpy.CalculateField_management(input_based_on_raster, "preview", "!cDataFileN!.replace(\".img\",\"_preview.jpg\").replace(\"\\\"\", \"\")", "PYTHON_9.3", "")

this code is put to "preview" folder the needed file name. But I need to put not simply filename, but filename with path like:
"C:\\folder\\foo_preview.jpg"
the folder variable is specified above. But I can't understand how to concatenate it with my file name. I tried to:
Code:

root = "c:\\folder\\"
arcpy.CalculateField_management(input_based_on_raster, "preview", root + "!cDataFileN!.replace(\".img\",\"_preview.jpg\").replace(\"\\\"\", \"\")", "PYTHON_9.3", "")

But it's do not work.

Viewing all articles
Browse latest Browse all 2485

Trending Articles