Arcpy: formatting string for file name

المشرف العام

Administrator
طاقم الإدارة
I have the following question about formatting a string which I use to create output file names.

I loop a SearchCursor to create .png file. I extract two columns form the cursor e.g. "GMS_ID" and "ID". (codepart - with arcpy.da.SearchCursor("dbk_object_test_SpatialJoin2",['GMS_ID','ID','SHAPE@']) as cur:)

Then I concatenate the two columns like:

vakkrt_name = str(row[0]) + "_" + str(row[1])

Almost at the end I use:

outpng = r"D:\arcpy\output\DBK_" + format(vakkrt_name) + ".png"

to create the file reference and after that I use:

arcpy.mapping.ExportToPNG(mxd, outpng,df, df_export_width=1600, df_export_height=1200, resolution=200)

to really create the file on disk.

The result is something like:

DBK_1234.0_5678.0.png

Can you help me by disabling the decimal point probably by using the Format method.

Kind regards.



أكثر...
 
أعلى