The functions described below provide the primary interface for this
module. If the module has not been initialized, they will call init()
if they rely on the information init() sets up.
mimetypes.init(files=None)
Initialize the internal data structures. If given, files must be a
sequence of file names which should be used to augment the default
type map. If omitted, the file names to use are taken from knownfiles;
on Windows, the current registry settings are loaded. Each file named
in files or knownfiles takes precedence over those named before it.
Calling init() repeatedly is allowed.
Specifying an empty list for files will prevent the system defaults
from being applied: only the well-known values will be present from a
built-in list.
根据^{} module documentation :
在Python 2.7和{a3}都有。在
如果要添加超出默认值的MIME类型/扩展映射,^{} 非常有用。如果不需要这样做,那么就不需要调用
mimetypes.init()
;只需正常使用实用程序函数,必要时它们会自己调用它。如果你需要这样做,除了mimetypes.init()
之外还有{a2}和{a3}。在这适用于Python2和3。在
相关问题 更多 >
编程相关推荐