def xmlToHtml(self): ''' 测试读取xml文件生成html文件 xmlToHtml() ''' weather.xmlToHtml('./template/wea2.xml')
filename = u'template/wea' + order + u'.xml' if filename in allwealist: nowlist = weather.xmlToList(filename) mess = ''.join((mess, u'\n\n系统采集正常,信息来源:', nowlist[0], u'\n')) mess = ''.join((mess, u'\n', u' '*4, nowlist[1])) tempstr = "| ".join(( zhLjust(nowlist[2], 20), zhLjust(nowlist[3], 20), zhLjust(nowlist[5], 20), zhLjust(nowlist[4], 40), )) mess = ''.join((mess, u'\n', u' '*4, tempstr)) tempstr = "| ".join(( zhLjust(nowlist[6], 20), zhLjust(nowlist[7], 20), zhLjust(nowlist[8], 20), )) mess = ''.join((mess, u'\n', u' '*4, tempstr)) tempstr = "| ".join(( zhLjust(nowlist[9], 20), zhLjust(nowlist[10], 20), zhLjust(nowlist[11], 20) )) mess = ''.join((mess, u'\n', u' '*4, tempstr)) for order in ORDER: filename = u'template/wea' + order + u'.xml' if filename in allwealist: mess = ''.join((mess, u'\n\n', u'='*16, u'\n\n系统采集正常,生成页面采用信息来源: ', filename)) weather.xmlToHtml(filename) weather.sendattachmail('*****@*****.**', u'天气预报运行报告', mess.encode('utf-8')) break