Thank you Danny and Joel :)

On Fri, Sep 12, 2014 at 9:51 PM, Joel Goldstick <joel.goldst...@gmail.com>
wrote:

> On Fri, Sep 12, 2014 at 12:04 PM, Danny Yoo <d...@hashcollision.org>
> 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  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --
> Joel Goldstick
> http://joelgoldstick.com
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to