我有這樣的:另一個列表理解問題
if Setting["Language"] == "en":
f.m_radioBox3.SetSelection(0)
elif Setting["Language"] == "pt":
f.m_radioBox3.SetSelection(1)
elif Setting["Language"] == "fr":
f.m_radioBox3.SetSelection(2)
elif Setting["Language"] == "es":
f.m_radioBox3.SetSelection(3)
然後我做了這一點:
Linguas = ["en","pt","fr","es"]
a = 0
for i in Linguas:
if i == Setting["Language"]:
f.m_radioBox3.SetSelection(a)
a += 1
是否有可能進一步簡化這一點,使之成爲一個班輪?
是的簡化,沒有列表理解 – nearlymonolith 2010-10-20 00:28:18