Skip to content

Instantly share code, notes, and snippets.

@adrienlachaize
Created January 10, 2014 10:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrienlachaize/8349832 to your computer and use it in GitHub Desktop.
Save adrienlachaize/8349832 to your computer and use it in GitHub Desktop.
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