3131专题

Mac系统解除UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0x80 in position 3131: invalid start byte

file_path = "xxx"files = os.listdir(file_path)contents = []for file in files:file_p = os.path.join(file_path, file)with open(file_p, 'r', encoding='utf-8') as f:a = f.read()[:200]contents.append(a)