0

I have the following code in Python 2.7.18.4 and when I run it, for each Tax Parcel Map, it prints the date and time and which parcel it is currently working on. When it is done and continues to the next parcel, it drops down a line on screen and prints the next parcel number it is working on.

import arcpy
import time

import_path = r"D:\DDP_ArcMap\Parcels_Data-Driven-Pages_blank.mxd"   # Path of .mxd
export_path = r"D:\DDP_ArcMap\PNG_Parcels\\"   # Path of output file

mxd = arcpy.mapping.MapDocument(import_path)
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
  mxd.dataDrivenPages.currentPageID = pageNum
  pageName = str(mxd.dataDrivenPages.pageRow.lrsn)
  pageName = pageName.replace(".0", "")
  arcpy.mapping.ExportToPNG(mxd, export_path + pageName + ".png")
  print time.ctime() +" -- " + "Exporting Tax Parcel Map " + str(pageNum) + " of " + str(mxd.dataDrivenPages.pageCount)
del mxd

Is there a way to overwrite the line each time with which parcel it is currently on along with the current date/time. I've tried several ways such as those listed here but with no luck: How to overwrite the previous print to stdout?

  • can you show an example of the current output and your expected output? I'm not completely understanding what you are trying to accomplish and why for example you can't just print what you want the line to look like from the start – Matthias Apr 14 '23 at 09:16

0 Answers0