How can i use a dictionnary

Dan Sommers dan at tombstonezero.net
Tue Jan 13 19:21:27 CET 2015


On Tue, 13 Jan 2015 06:56:11 -0800, Novocastrian_Nomad wrote:

> On Tuesday, January 13, 2015 at 2:03:30 AM UTC-7, brice DORA wrote:

>> i consume a web service that return a element whose the type is
>> "instance". but this element seem be a dictionary but when i want to
>> use it like a dictionary, i got some errors. so this is the element
>> and please someone can tell me how can i use it. tkanks in advance.
>> 
>> (tCountryInfo){
>>    sISOCode = "CI"
>>    sName = "Côte D'Ivoire (Ivory Coast)"
>>    sCapitalCity = "Yamoussoukro"
>>    sPhoneCode = "225"
>>    sContinentCode = "AF"
>>    sCurrencyISOCode = "XOF"
>>    sCountryFlag = "http://www.oorsprong.org/WebSamples.CountryInfo/Images/Côte D'Ivoire.jpg"
>>    Languages = 
>>       (ArrayOftLanguage){
>>          tLanguage[] = 
>>             (tLanguage){
>>                sISOCode = "fr"
>>                sName = "French"
>>             },
>>       }
>>  }

> This data is not a Python dictionary, nor is it a JSON object.  You
> will probably need to code your own conversion function to make it a
> Python dictionary.

This looks like the str (or maybe it's the repr) of an object returned
by the suds library.  If so, then that object has appropriate attributes
for accessing the data; please see the documentation.  What happens when
you print object.sName (assuming that your element is named "object")?

HTH,
Dan



More information about the Python-list mailing list