I have a main function that contains two dictionaries that I would like to output. I have omitted how the dictionaries were created.
here’s my function:
def main()
dict1 = {'a1':{'b1':1,'c1':2},'a2':{'b2':1,'c2':2}}
dict2 = {'cat':0,'dog':2}
return dict1, dict2
if __main__ == '__main__':
>...main()
here’s how I’m calling it in the python prompt:
>>from filename import *
>>x,y=main()
More or less this is what I’m getting
>>print x
'a1'
>>print y
'a2'
But this is what I want:
>>print x
{'a1':{'b1':1,'c1':2},'a2':{'b2':1,'c2':2}}
>>print y
{'cat':0,'dog':2}
What am I not doing right?
The code already does exactly what you expect it to:
Perhaps you’re accidentally calling a different
main()function (e.g. one that has a differentreturnstatement)?