I have a Python program which is going to take text files as input. However, some of these files may be gzip compressed.
Is there a cross-platform, usable from Py
Doesn’t seem to work well in python3...
import mimetypes
filename = "./datasets/test"
def file_type(filename):
type = mimetypes.guess_type(filename)
return type
print(file_type(filename))
returns (None, None) But from the unix command "File"
:~> file datasets/test datasets/test: gzip compressed data, was "iostat_collection", from Unix, last modified: Thu Jan 29 07:09:34 2015