成功男人背後的女人為什麼不幸福?
python - 'has_key()' or 'in'? - Stack Overflow 幸福從來是相對的。 身患重病的人會覺得健康是一種幸福。骨肉分離的人會覺得闔家團聚是一種幸福。高考落榜的人會覺得接到大學錄取通知書是一種幸福。衣食無著的人會覺得有吃有穿是一種幸福。有億萬家財的人往往人人羨慕,但他們反而會覺得那些沒有多少負擔、活得輕鬆簡單的人更幸福。許多在雨夜中趕路被淋得渾身透濕的人I wonder what is better to do: d = {'a': 1, 'b': 2} 'a' in d True or: d = {'a': 1, 'b': 2} d.has_key('a') True ... One semi-gotcha to avoid though is to make sure you do: "key in some_dict" rather than "key in some_dict.keys()". Both are equivalent semant...
全文閱讀