import chardetdef CheckCode(filename): adchar=chardet.detect(filename) if adchar[‘encoding‘]==‘utf-8‘: filename=filename.decode(‘utf-8‘) else: filename=filename.decode(‘gbk‘) return filename
时间: 2024-11-05 20:33:27
import chardetdef CheckCode(filename): adchar=chardet.detect(filename) if adchar[‘encoding‘]==‘utf-8‘: filename=filename.decode(‘utf-8‘) else: filename=filename.decode(‘gbk‘) return filename