類型轉換字符類型

最近調用物流接口遇到返回類型爲:<class 'suds.sax.text.Text'>

對方使用的是SOAP通信,通過WSDL 方式請求並返回結果,

print type(orcl_quote_resp)
<class 'suds.sax.text.Text'>

父類是一個字符類型

object --+        
         |        
basestring --+    
             |    
       unicode --+
                 |
                Text

from xml.sax.saxutils import escape

print type(escape(create_response))

轉換成字符類型

create_response = json.loads(escape(create_response)) 

因爲實際需要,該字符包含的是一個字典,轉換成字典類型


<class 'suds.sax.text.Text'>具體介紹請查看下面鏈接:


https://jortel.fedorapeople.org/suds/doc/suds.sax.text.Text-class.html



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章