Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check if the given file is .txt
import mimetypes
def is_txt_file(file):
"""Test if the file is a txt file."""
mime = mimetypes.guess_type(file)
if mime[0] == 'text\plan':
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.