Check Whether a File Is a Text File in Python Nov 27, 2020 python-magic¶python-magic is the recommended library to use for checking whether a file is a text file.