Skip to content

Instantly share code, notes, and snippets.

@capjamesg
Last active October 18, 2021 12:55
Show Gist options
  • Save capjamesg/ba9d17cb650ccbf760be44a0b4ae72ad to your computer and use it in GitHub Desktop.
Save capjamesg/ba9d17cb650ccbf760be44a0b4ae72ad to your computer and use it in GitHub Desktop.
slugs = {}
slug = "xyz"
if slugs.get(slug):
slugs[slug] += 1
slug = slug + "-" + str(slugs[slug])
else:
slugs[slug] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment