Skip to content

Instantly share code, notes, and snippets.

@hozumi
Created November 23, 2015 18:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hozumi/855fa8d42aef15b88829 to your computer and use it in GitHub Desktop.
Save hozumi/855fa8d42aef15b88829 to your computer and use it in GitHub Desktop.
import re
import unicodedata
def slugify(value, separator):
""" Slugify a string, to make it URL friendly. """
normalized = unicodedata.normalize('NFKD', value)
v = normalized.strip().lower()
return re.sub('[%s\s]+' % separator, separator, v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment