Python Get Text File Character Encoding: A Beginner Guide – Python Tutorial

Text file, such as .txt, .csv, .xml et al, is encoded by special character encoding (utf-8, gbk, gb2312, …). How to get the character encoding of a text file? We will use a simple python example to show you how to do.