util.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:aiodownload 作者: jelloslinger 项目源码 文件源码
def clean_filename(filename):
    """Return a sanitized filename (replace / strip out illegal characters)

    :param filename: string used for a filename
    :type filename: str

    :return: sanitized filename
    :rtype: str
    """

    return ''.join([
        c for c in unicodedata.normalize(
            'NFKD',
            ''.join([REPLACEMENT_CHAR.get(c, c) for c in filename])
        )
        if not unicodedata.combining(c) and c in '-_.() {0}{1}'.format(string.ascii_letters, string.digits)
    ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号