python(写入txt乱码解决)







with open('test1.txt','a+',encoding='utf-8')as file:
    data_txt=json.dumps(item,ensure_ascii=False)   
      #####txt乱码写入解决 ensure_ascii=False######
    file.write(data_txt + '\n')