def normalize_string(text):
'''normalize string, strip all special chars'''
text = text.replace(":", "")
text = text.replace("/", "-")
text = text.replace("\\", "-")
text = text.replace("<", "")
text = text.replace(">", "")
text = text.replace("*", "")
text = text.replace("?", "")
text = text.replace('|', "")
text = text.replace('(', "")
text = text.replace(')', "")
text = text.replace("\"", "")
text = text.strip()
text = text.rstrip('.')
if not isinstance(text, unicode):
text = text.decode("utf-8")
text = unicodedata.normalize('NFKD', text)
return text
utils.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录