I have a list, not dict, that contains information. When I simply do print my_list it yields:
[<Data_1: name=u'Name of A',id=101>,
<Data_2: name=u'Name of B',id=102>,
<Data_3: name=u'Name of C',id=103>,
...]
When I do for x in my_list: print x it yields:
Name of A
Name of B
Name of C
...
Clearly Python is parsing this somehow but how would I extract both the name and id portions of each element? If this was in a dict, I would do my_list.iteritems but I am a little stuck on how to do this with just a normal list.
Thanks
<Data_1: name=u'Name of A',id=101>definitely a queryset. Sox.nameandx.idshould work.__str__method, whereas printing a list containing objects invokes their__repr__methods.