Created
November 23, 2015 18:57
-
-
Save hozumi/855fa8d42aef15b88829 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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