python 怎样识别文件类型

如题所述

通过后缀名来区分文件类型

import os
suffix = os.path.splitext(r"c:\111\2222.txt")[-1]
print suffix

温馨提示:答案为网友推荐,仅供参考