Skip to content

Instantly share code, notes, and snippets.

Last active Jun 25, 2017
What would you like to do?
Slugify Chinese
# coding=utf-8
Slugify for Chinese
import re
import unidecode
def slugify(str):
return re.sub(r'\s+', '-', unidecode.unidecode(str).lower().strip())
# Test
print slugify(u"测试")
# >>> ce-shi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment