エントリーの編集
![loading...](https://b.st-hatena.com/bdefb8944296a0957e54cebcfefc25c4dcff9f5f/images/v4/public/common/loading@2x.gif)
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
【Python】辞書型(dictionary)からキー・値を取得するitems
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
![アプリのスクリーンショット](https://b.st-hatena.com/bdefb8944296a0957e54cebcfefc25c4dcff9f5f/images/v4/public/entry/app-screenshot.png)
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
【Python】辞書型(dictionary)からキー・値を取得するitems
辞書型(dictionary)を取り出す構文 # 辞書型(dictionary)をリスト型で取得する 変数.items() # 辞書... 辞書型(dictionary)を取り出す構文 # 辞書型(dictionary)をリスト型で取得する 変数.items() # 辞書型(dictionary)をリスト型で取得する for キーの変数,値の変数 in 辞書型.items(): 処理 Pythonの「辞書型(dictionary)」に「.items()」とすると、リスト型 listで取得することができます。 また、キーと値を個別に取り出すには、for文を使います。 例1. 辞書型(dictionary)のキー・値をセットで取り出す # 辞書型(dictionary) sports = {'A01':'baseball','A02':'football','A03':'tennis'} sp = sports.items() print(sp) #[結果] dict_items([('A01', 'baseball'), ('A