I am looking for a function in Python to determine the type of a file. I mean, the input is the path where the file is located, and the output is the type.
Thanks for your help
I am looking for a function in Python to determine the type of a file. I mean, the input is the path where the file is located, and the output is the type.
Thanks for your help
 
    
     
    
    If looking at the extension is enough, mimetypes.guess_type() is your friend.
For more robust identification, you might want to look at python-magic.
