需要帮助了解为什么此代码段未按预期返回
>>> a = 1
>>> v = ["a", "b", "c"]
>>> {e for e in v if locals().get(e) is None}
set(['a', 'c', 'b'])
我希望它会返回set(['c', 'b'])
,就像我建立一个列表一样
>>> [e for e in v if locals().get(e) is None]
['b', 'c']
需要帮助了解为什么此代码段未按预期返回
>>> a = 1
>>> v = ["a", "b", "c"]
>>> {e for e in v if locals().get(e) is None}
set(['a', 'c', 'b'])
我希望它会返回set(['c', 'b'])
,就像我建立一个列表一样
>>> [e for e in v if locals().get(e) is None]
['b', 'c']