Django 中文转化成拼音的工具slug

安装

pip install django-uuslug

载入模块
In [1]: from uuslug import slugify

In [2]: txt = "This is a test"

In [3]: slugify(txt)
Out[3]: u'this-is-a-test'

In [4]: txt = "这是一个测试"

In [5]: slugify(txt)
Out[5]: u'zhe-shi-yi-ge-ce-shi'```

你可能感兴趣的:(Django 中文转化成拼音的工具slug)