2014年2月20日
摘要: 一、读取1、xml.dom.minidomimport xml.dom.minidomdoc=xml.dom.minidom.parse(file)#xml.dom.minidom.parseString(string)root=doc.documentElementfor node in root.childNodes: #print node,node.nodeName,node.nodeValue,node.nodeType #,node.data (for textnode) if node.nodeName=='channel': #and node.nodeType 阅读全文
posted @ 2014-02-20 16:53 perel 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 1、#coding=utf8文本的字符编码s=u'xxxx'.encode('utf8')2、sys.getdefaultencoding,sys,setdefaultencoding转换缺省使用编码s.decode('utf8').encode('gbk')通常s.decode('utf8'),unicode也能正确输出3、sys.stdin.encoding,sys.stdout.encoding输出编码sys.stdout.encoding='gbk'改变标准输出流的编码方式的方法import 阅读全文
posted @ 2014-02-20 10:46 perel 阅读(250) 评论(0) 推荐(0) 编辑