oops.there should be no sterisk. item_dict=dict([(r.id,r) for r in db(db.items.id > 0).select()])
On Oct 29, 8:30 am, Fran <[email protected]> wrote: > On Oct 29, 4:49 am, mdipierro <[email protected]> wrote: > > > actually I also need this often. I normally do > > item_dict=dict([*r.id,r) for r in db(db.items.id > 0).select()]) > > or > > item_dict=dict([*r.id,r) for r in db(db.items.id > 0).select().as_list > > ()]) > > Looks nice - but there's a typo & I can't quite get the correct form - > always gives a SyntaxError on the asterisk: * > I've tried all combinations of brackets, but no joy - fix welcomed :) > > F --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

