Thank you Danny and Joel :) On Fri, Sep 12, 2014 at 9:51 PM, Joel Goldstick <[email protected]> wrote:
> On Fri, Sep 12, 2014 at 12:04 PM, Danny Yoo <[email protected]> > wrote: > > > >> i wrote a code like this > >> > >> for i in res: > >> dict = {} > >> dict['id_desc'] = str(i['id'])+','+str(i['description']) > > A minor revision for the right side of above: > ",".join(str(i['id'], str(i['description'])) > > >> i.update(dict) > >> > >> is there any other simple methods to achieve this? > >> > > > > Can you avoid the intermediate "dict" and just assign to i['id_desc'] > > directly? > > > > > > _______________________________________________ > > Tutor maillist - [email protected] > > To unsubscribe or change subscription options: > > https://mail.python.org/mailman/listinfo/tutor > > > > > > -- > Joel Goldstick > http://joelgoldstick.com > _______________________________________________ > Tutor maillist - [email protected] > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
