我想确定一个XML文件的MIME类型,但是我收到了关于某个实例作为第一个参数的错误。我是Python的新手,请帮忙。以下是我正在使用的代码以及它抛出的错误。
from mimetypes import MimeTypes
import urllib
FILENAME = 'Upload.xml'
url = urllib.pathname2url(FILENAME)
type = MimeTypes.guess_type(url)
print type
**ERROR :** Traceback (most recent call last):
File "/home/navi/Desktop/quicksort.py", line 20, in <module>
type = MimeTypes.guess_type(url)
TypeError: unbound method guess_type() must be called with MimeTypes instance as first argument (got str instance instead)