Skip to content

Instantly share code, notes, and snippets.

@shunfan
Last active June 25, 2017 20:18
Show Gist options
  • Select an option

  • Save shunfan/5847732 to your computer and use it in GitHub Desktop.

Select an option

Save shunfan/5847732 to your computer and use it in GitHub Desktop.
Slugify Chinese
import re
import unidecode
def slugify(str):
str = unidecode.unidecode(str).lower()
str = str.strip()
str = re.sub(r"\s+", '-', str)
return str
# Test
slugify(u"测试")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment