masterString = '' # some geoprocessing on dataset str_gp1_success = 'Completed GP1 on: %s' % dataset arcpy.AddMessage(str_gp1_success) masterString += '\n'+str_gp1_success # append the new string to the master, with a new line...
outputFile = 'C:\\Temp\\output.txt' w = open(outputFile,'w') # open file buffer - the second argument, w, tells it to open for writing w.write(masterString) w.close()
outputFile = 'C:\\Temp\\output.txt' if os.path.exists(outputFile ): # write to file... os.remove(outputFile ) print 'Deleted; %s' % outputFile w = open(outputFile,'w') # open file buffer - the second argument, w, tells it to open for writing w.write(masterString) w.close()
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.