class Timer: def __enter__(self): self.start = time.clock() return self def __exit__(self, *args): self.end = time.clock() self.interval = self.end - self.start import arcpy t = Timer() with t: #list the things in the workspace ws_output = r'in_memory' for fc in arcpy.ListFeatureClasses(): print fc itemsecs = "Total processing seconds: %.02f secs." % (t.interval) print itemsecs
import time time1 = time.clock() #do stuff time2 = time.clock() print "Stuff took " + str(time2-time1) + " seconds"
import datetime start = datetime.datetime.now() print 'start run: %s\n' % (start) ### do groovy stuff here print 'finished run: %s\n\n' % (datetime.datetime.now() - start)
import time
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.