首页 > 编程语言 > 详细

python 打印输出xml数据问题

时间:2018-05-08 18:12:56      阅读:221      评论:0      收藏:0      [点我收藏+]

rf+sublime框架测试接口:

python一开始遇到 输出返回值问题,打不出来;

def GetBaseInfo(self, RecordRelatedNumber):
ret=self.comlib.GetBaseInfo( RecordRelatedNumber)
return ret     

#直接返回数据ret,问题解决


# if ret==0:
# return 0
# else:
# return self.GetLastError()

 

直接return,有问题,报错

格式问题;   UnicodeEncodeError: ‘ascii‘ codec can‘t encode character u‘\u7537‘ in position 119: ordinal not in range(128)

引入文件后,

import sys
reload(sys)
sys.setdefaultencoding(‘utf-8‘)

问题解决;

<?xml version="1.0" encoding="GBK"?>
<ClinicalBaseDocElement>
<LocationCode>12345678</LocationCode>
<patientSex>男</patientSex>
<HosptializationCount>1</HosptializationCount>
<EncompassingEncounterType>门诊</EncompassingEncounterType>
<patientId>110911199901010000</patientId>
<PatientId>110911199901010000</PatientId>
<PatientNo>201606070011201</PatientNo>
<PerformerId>1</PerformerId>
<patientBirthday>19990101</patientBirthday>
<EncompassingEncounterDate>20160607</EncompassingEncounterDate>
<OutPatientNo>20160607001101</OutPatientNo>
<recordRelatedNumber>999#9999#99999</recordRelatedNumber>
<patientName>张三</patientName>
</ClinicalBaseDocElement>

 

python 打印输出xml数据问题

原文:https://www.cnblogs.com/wzl629/p/9009744.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!