Re: [問題] 優化程式碼,轉成 dict

作者: poototo (poototo)   2022-12-03 10:17:31
再補充
1. 用Comprehension,可與map, filter比較
d = {k: v for k, v in (L.split(' - ') for L in contents.splitlines() if L)}
作者: wadd (醜男轉世-低調)   2021-01-20 03:41:00
謝謝前輩指點,又學到很多招

Links booklink

Contact Us: admin [ a t ] ucptt.com