LoginSignup
3
4

More than 5 years have passed since last update.

dictのkeyにlist要素が全て存在するかどうかを判定

Last updated at Posted at 2017-04-24

hoge のkeyに fuga の要素が全て含まれているかどうかの判定

>>> hoge = {"a":1, "b":2, "c":3}
>>> fuga = ["a", "b"]
>>> 
>>> set(fuga).issubset(set(hoge.keys()))
True
3
4
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4