如何在dict理解中进行可变注释?

时间:2018-12-25 13:42:51

标签: python python-2.7 dictionary dictionary-comprehension

给出以下字典理解

SELECT ur.login_id,
       GROUP_CONCAT(DISTINCT ue.user_email_address) as emails,
       GROUP_CONCAT(DISTINCT up.phone_number) as phones
FROM greydeltadb.gd_user ur LEFT JOIN
     greydeltadb.gd_user_emails ue
     ON ur.user_id = ue.user_id LEFT JOIN
     greydeltadb.gd_phone up
     ON ur.user_id = up.user_id  
GROUP BY ur.login_id  ;

我可以用某种方式对此{key: func(key) for key in range(5) if func(key) is not None} 进行注释,这样我就不必对其进行两次计算吗?预先感谢

0 个答案:

没有答案