python 打印输出xml数据问题

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>

 

转载于:https://www.cnblogs.com/wzl629/p/9009744.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值