Given a list like this:
mylist = ["name", "state", "name", "city", "name", "zip", "zip"]
I would like to rename the duplicates by appending a number to get the following result:
mylist = ["name1", "state", "name2", "city", "name3", "zip1", "zip2"]
I do not want to change the order of the original list. The solutions suggested for this related Stack Overflow question sorts the list, which I do not want to do.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…