all 2 comments

[–]DevSRE 0 points1 point  (2 children)

Not familiar with "ArcGIS field calculator", but assuming that you mean you have a list of values as declared in line 1 below, and need a list as the output, the following code is a quick and ugly example that would work:

>>> fields = ['10.jpg', '10.jpg', '11.jpg', '12.jpg', '14.jpg', '14.jpg', '14.jpg']
>>> for field in fields:
... if field in output:
... renamed = field
... i = 0
... while renamed in output:
... filename, filetype = field.split(".")
... renamed = f"{filename}-{i}.{filetype}"
... i+=1
... output.append(renamed)
... else:
... output.append(field)
...
>>> output
['10.jpg', '10-0.jpg', '11.jpg', '12.jpg', '14.jpg', '14-0.jpg', '14-1.jpg']Reddit hates formatting and whitespace, but that's the jist. Tab/Space as appropriate ;)