Saving files with Duplicate Filenames
If I want to save a file, but make sure to not overwrite files, and instead append a number to the end of the file name using Python I may want to write something like this:
#in this case I want to take a title and use it as a filename
filename = title
counter = 1
while os.path.isfile(filename):
filename = title + " " + str(counter)
counter = counter + 1
# write a file using the filename variable as a filename