Hi, consider two objects, ls_dic=[{'key1':a , 'key2': b},{'key1':c , 'key2': d}] num=sum([len(x.values()) for x in ls_dic])
print '%s' % ','.join(sorted(sum([x.values() for x in ls_dic],[])))[:-num] print '%s' % ','.join(sorted(sum([x.values() for x in ls_dic],[])))[num:] This is will help a lot. ls_dic list object is considered for input. I used num object to store number of values in each directory item of ls_dic list. This object is used in further 2 print statements. These statements will print in expected output fashion. Check it out. Enjoy!!!!! On Sun, Feb 15, 2015 at 7:59 PM, Shai Efrati <sha...@gmail.com> wrote: > sorry. > assuming: > l = [{'key1':'a' , 'key2': 'b'},{'key1':'c' , 'key2': 'd'}] > > for e in l: > for k, v in e.iteritems(): > print v, > print > > On 2/15/15, Shai Efrati <sha...@gmail.com> wrote: > > assuming: > > l = [{'key1':a , 'key2': b},{'key1':c , 'key2': d}] > > > > for e in l: > > for k, v in iteritems(e): > > print v, > > print > > > > > > > > On 2/15/15, aronivi...@gmail.com <aronivi...@gmail.com> wrote: > >> [{'key1':a , 'key2': b},{'key1':c , 'key2': d}] > >> a,b > >> c,d > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Django users" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to django-users+unsubscr...@googlegroups.com. > >> To post to this group, send email to django-users@googlegroups.com. > >> Visit this group at http://groups.google.com/group/django-users. > >> To view this discussion on the web visit > >> > https://groups.google.com/d/msgid/django-users/90d2e6f3-ed06-40f3-a6cd-29e895504710%40googlegroups.com > . > >> For more options, visit https://groups.google.com/d/optout. > >> > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CALr%3D9OUwqwh5oX1974DPRGuiPUWBVvWu7WX1gFSzidHWwt4RKw%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- Krishnasagar S. Subhedarpage India -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAChYJc-ReDbRhCidNw-XO7kufhwja-LkWhSSv9ExNSOEHQPwdQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.