美文网首页Python
「Python」secure_filename获取中文文件名问题

「Python」secure_filename获取中文文件名问题

作者: ray_1942 | 来源:发表于2019-01-22 21:51 被阅读0次

问题

用secure_filename获取中文文件名时,获取到的只有后缀???

解决

搜遍各大论坛基本两派:
1、修改源码派;
2、自定义工具派。

3、不过还有一种办法:
from pypinyin import lazy_pinyin

filename = secure_filename(''.join(lazy_pinyin(file.filename)))

相关文章

网友评论

    本文标题:「Python」secure_filename获取中文文件名问题

    本文链接:https://www.haomeiwen.com/subject/lxtdjqtx.html