python ElementTree处理gbk(或者gb2312)编码的XML文件的方法:1,py文件的编码是utf-8,即在文件最开始有如下语句声明编码方式:#-*-coding: utf-8-*-2,读取文件内容时转码为utf-8的:xml_file_text = open(xml_file_name).read().decode('gbk').encode('utf-8')这样在处理过程中均是utf-8编码的字符串