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()
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.