I have a Python list and there is exactly one element which is repeated thrice. I want to replace them with unique element.
my_list = [,...,'future_use',...,'future_use',..'future_use',...]
Expected o/p:
[,...,'future_use1',...,'future_use2',..'future_use3',...]
I tried using list comprehension:
count = my_list.count("future_use")
for i in range(1, count+1):
my_list = [item.replace("future_use","future_use%r" %i,i) for item in my_list]
However, I'm not getting desired output.Can someone point me to the correct procedure?