python2.7
使用了 -*- coding: utf-8 -*-
account_file_name = '芷江_txt'
with open(account_file_path, 'a') as fp:...
生成的文件名是乱码,因为with open()中的文件名需要Unicode类型,需要用decode将utf-8转为Unicode类型。
decode(char_set)可以实现其他编码到Unicode的转换,encode(char_set)实现Unicode到其他编码的转换。