AnsweredAssumed Answered

how to export page range in arcpy Data driven pages script

Question asked by t.faull on Jul 22, 2014
Latest reply on Jul 23, 2014 by t.faull


I have my script for exporting multiple DDP exports to JPEG format:

>>> import arcpy
... mxd = arcpy.mapping.MapDocument("CURRENT")
... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
...     mxd.dataDrivenPages.currentPageID = pageNum
...     print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
...     arcpy.mapping.ExportToJPEG(mxd, r"X:\DVDs to burn\South Atlantic Margins\Arcview projects\A3 & A4 Images and Export mxd's\2014 DDP A3 Exports\Images\Free Air" + str(pageNum) + ".jpg")
... del mxd

But I need to only export certain pages at a time, not the whole set!

In this case I want pages 1,3,5,7,9 to be exported.

how can I modify my script for this?