python 列印輸出xml資料問題

來源:互聯網
上載者:User

標籤:birt   return   count   default   import   檔案   inf   element   問題   

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資料問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.