如何猜测python中文件的类型? [英] How to guess the type of a file in python?

查看:48
本文介绍了如何猜测python中文件的类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法或软件包可以猜测Python中文件的类型?例如,这是一种检测文件可能以ascii,unicode或二进制文件打开的方法吗?

Is there a way or a package to guess the type of a file in Python? For example, is it a way to detect a file could be open as ascii, unicode or binary?

提前谢谢!

推荐答案

您需要 filemagic模块.

这篇关于如何猜测python中文件的类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆