質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
ファイル

ファイルとは、文字列に基づいた名前又はパスからアクセスすることができる、任意の情報のブロック又は情報を格納するためのリソースです。

JSON

JSON(JavaScript Object Notation)は軽量なデータ記述言語の1つである。構文はJavaScriptをベースとしていますが、JavaScriptに限定されたものではなく、様々なソフトウェアやプログラミング言語間におけるデータの受け渡しが行えるように設計されています。

リストボックス

ユーザーがリストから1つ以上のアイテムを選択できるようにするGUI要素です。

連結リスト

連結リストとは、データ構造のひとつであるリストの中で、要素が前後の要素の情報を持つことで、要素が連結(リンク)しているリストの事を呼びます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

918閲覧

リスト内辞書の特定のキーと値を抽出し一つのjsonにまとめたい

Kokku

総合スコア39

ファイル

ファイルとは、文字列に基づいた名前又はパスからアクセスすることができる、任意の情報のブロック又は情報を格納するためのリソースです。

JSON

JSON(JavaScript Object Notation)は軽量なデータ記述言語の1つである。構文はJavaScriptをベースとしていますが、JavaScriptに限定されたものではなく、様々なソフトウェアやプログラミング言語間におけるデータの受け渡しが行えるように設計されています。

リストボックス

ユーザーがリストから1つ以上のアイテムを選択できるようにするGUI要素です。

連結リスト

連結リストとは、データ構造のひとつであるリストの中で、要素が前後の要素の情報を持つことで、要素が連結(リンク)しているリストの事を呼びます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2021/04/06 09:14

emotions.json

1[{"face_token": "fca7b4c5c1910e9be6567d57e17ab457", "face_rectangle": {"top": 64, "left": 31, "width": 214, "height": 214}, "landmark": {"contour_chin": {"x": 117, "y": 273}, "contour_left1": {"x": 33, "y": 101}, "contour_left2": {"x": 33, "y": 124}, "contour_left3": {"x": 35, "y": 147}, "contour_left4": {"x": 37, "y": 169}, "contour_left5": {"x": 42, "y": 192}, "contour_left6": {"x": 49, "y": 213}, "contour_left7": {"x": 61, "y": 233}, "contour_left8": {"x": 76, "y": 250}, "contour_left9": {"x": 93, "y": 265}, "contour_right1": {"x": 247, "y": 107}, "contour_right2": {"x": 246, "y": 133}, "contour_right3": {"x": 242, "y": 159}, "contour_right4": {"x": 238, "y": 184}, "contour_right5": {"x": 230, "y": 209}, "contour_right6": {"x": 215, "y": 230}, "contour_right7": {"x": 195, "y": 247}, "contour_right8": {"x": 171, "y": 260}, "contour_right9": {"x": 146, "y": 271}, "left_eye_bottom": {"x": 77, "y": 107}, "left_eye_center": {"x": 79, "y": 101}, "left_eye_left_corner": {"x": 57, "y": 101}, "left_eye_lower_left_quarter": {"x": 66, "y": 104}, "left_eye_lower_right_quarter": {"x": 89, "y": 107}, "left_eye_pupil": {"x": 79, "y": 99}, "left_eye_right_corner": {"x": 100, "y": 107}, "left_eye_top": {"x": 79, "y": 92}, "left_eye_upper_left_quarter": {"x": 67, "y": 94}, "left_eye_upper_right_quarter": {"x": 91, "y": 97}, "left_eyebrow_left_corner": {"x": 42, "y": 80}, "left_eyebrow_lower_left_quarter": {"x": 55, "y": 76}, "left_eyebrow_lower_middle": {"x": 69, "y": 77}, "left_eyebrow_lower_right_quarter": {"x": 83, "y": 84}, "left_eyebrow_right_corner": {"x": 99, "y": 89}, "left_eyebrow_upper_left_quarter": {"x": 54, "y": 65}, "left_eyebrow_upper_middle": {"x": 71, "y": 65}, "left_eyebrow_upper_right_quarter": {"x": 87, "y": 74}, "mouth_left_corner": {"x": 78, "y": 189}, "mouth_lower_lip_bottom": {"x": 124, "y": 230}, "mouth_lower_lip_left_contour1": {"x": 98, "y": 208}, "mouth_lower_lip_left_contour2": {"x": 87, "y": 208}, "mouth_lower_lip_left_contour3": {"x": 101, "y": 223}, "mouth_lower_lip_right_contour1": {"x": 149, "y": 210}, "mouth_lower_lip_right_contour2": {"x": 159, "y": 211}, "mouth_lower_lip_right_contour3": {"x": 145, "y": 224}, "mouth_lower_lip_top": {"x": 124, "y": 217}, "mouth_right_corner": {"x": 168, "y": 193}, "mouth_upper_lip_bottom": {"x": 125, "y": 198}, "mouth_upper_lip_left_contour1": {"x": 117, "y": 191}, "mouth_upper_lip_left_contour2": {"x": 97, "y": 189}, "mouth_upper_lip_left_contour3": {"x": 102, "y": 194}, "mouth_upper_lip_right_contour1": {"x": 133, "y": 191}, "mouth_upper_lip_right_contour2": {"x": 151, "y": 191}, "mouth_upper_lip_right_contour3": {"x": 147, "y": 195}, "mouth_upper_lip_top": {"x": 125, "y": 193}, "nose_contour_left1": {"x": 109, "y": 104}, "nose_contour_left2": {"x": 100, "y": 141}, "nose_contour_left3": {"x": 105, "y": 170}, "nose_contour_lower_middle": {"x": 123, "y": 178}, "nose_contour_right1": {"x": 140, "y": 105}, "nose_contour_right2": {"x": 148, "y": 144}, "nose_contour_right3": {"x": 141, "y": 172}, "nose_left": {"x": 91, "y": 158}, "nose_right": {"x": 155, "y": 162}, "nose_tip": {"x": 124, "y": 164}, "right_eye_bottom": {"x": 173, "y": 109}, "right_eye_center": {"x": 172, "y": 104}, "right_eye_left_corner": {"x": 152, "y": 106}, "right_eye_lower_left_quarter": {"x": 162, "y": 108}, "right_eye_lower_right_quarter": {"x": 184, "y": 108}, "right_eye_pupil": {"x": 172, "y": 102}, "right_eye_right_corner": {"x": 193, "y": 105}, "right_eye_top": {"x": 172, "y": 95}, "right_eye_upper_left_quarter": {"x": 161, "y": 98}, "right_eye_upper_right_quarter": {"x": 183, "y": 98}, "right_eyebrow_left_corner": {"x": 150, "y": 92}, "right_eyebrow_lower_left_quarter": {"x": 169, "y": 90}, "right_eyebrow_lower_middle": {"x": 186, "y": 86}, "right_eyebrow_lower_right_quarter": {"x": 202, "y": 84}, "right_eyebrow_right_corner": {"x": 216, "y": 87}, "right_eyebrow_upper_left_quarter": {"x": 166, "y": 79}, "right_eyebrow_upper_middle": {"x": 184, "y": 72}, "right_eyebrow_upper_right_quarter": {"x": 204, "y": 72}}, "attributes": {"gender": {"value": "Male"}, "age": {"value": 26}, "emotion": {"anger": 98.934, "disgust": 1.06, "fear": 0.002, "happiness": 0.001, "neutral": 0.001, "sadness": 0.001, "surprise": 0.002}}}, 2 3{"face_token": "b0df2c32adc1e411460823af811648c9", "face_rectangle": {"top": 68, "left": 19, "width": 213, "height": 213}, "landmark": {"contour_chin": {"x": 125, "y": 281}, "contour_left1": {"x": 30, "y": 104}, "contour_left2": {"x": 30, "y": 127}, "contour_left3": {"x": 32, "y": 151}, "contour_left4": {"x": 36, "y": 174}, "contour_left5": {"x": 43, "y": 197}, "contour_left6": {"x": 54, "y": 218}, "contour_left7": {"x": 67, "y": 238}, "contour_left8": {"x": 82, "y": 256}, "contour_left9": {"x": 100, "y": 273}, "contour_right1": {"x": 223, "y": 105}, "contour_right2": {"x": 223, "y": 129}, "contour_right3": {"x": 220, "y": 152}, "contour_right4": {"x": 216, "y": 176}, "contour_right5": {"x": 210, "y": 199}, "contour_right6": {"x": 199, "y": 220}, "contour_right7": {"x": 186, "y": 240}, "contour_right8": {"x": 170, "y": 258}, "contour_right9": {"x": 151, "y": 274}, "left_eye_bottom": {"x": 81, "y": 109}, "left_eye_center": {"x": 82, "y": 104}, "left_eye_left_corner": {"x": 63, "y": 102}, "left_eye_lower_left_quarter": {"x": 71, "y": 106}, "left_eye_lower_right_quarter": {"x": 91, "y": 109}, "left_eye_pupil": {"x": 81, "y": 104}, "left_eye_right_corner": {"x": 100, "y": 109}, "left_eye_top": {"x": 82, "y": 98}, "left_eye_upper_left_quarter": {"x": 72, "y": 98}, "left_eye_upper_right_quarter": {"x": 92, "y": 102}, "left_eyebrow_left_corner": {"x": 47, "y": 81}, "left_eyebrow_lower_left_quarter": {"x": 61, "y": 78}, "left_eyebrow_lower_middle": {"x": 75, "y": 82}, "left_eyebrow_lower_right_quarter": {"x": 88, "y": 90}, "left_eyebrow_right_corner": {"x": 104, "y": 95}, "left_eyebrow_upper_left_quarter": {"x": 60, "y": 69}, "left_eyebrow_upper_middle": {"x": 78, "y": 72}, "left_eyebrow_upper_right_quarter": {"x": 93, "y": 80}, "mouth_left_corner": {"x": 80, "y": 194}, "mouth_lower_lip_bottom": {"x": 125, "y": 236}, "mouth_lower_lip_left_contour1": {"x": 98, "y": 216}, "mouth_lower_lip_left_contour2": {"x": 89, "y": 214}, "mouth_lower_lip_left_contour3": {"x": 103, "y": 229}, "mouth_lower_lip_right_contour1": {"x": 152, "y": 218}, "mouth_lower_lip_right_contour2": {"x": 161, "y": 218}, "mouth_lower_lip_right_contour3": {"x": 147, "y": 231}, "mouth_lower_lip_top": {"x": 126, "y": 225}, "mouth_right_corner": {"x": 171, "y": 199}, "mouth_upper_lip_bottom": {"x": 128, "y": 194}, "mouth_upper_lip_left_contour1": {"x": 119, "y": 184}, "mouth_upper_lip_left_contour2": {"x": 98, "y": 186}, "mouth_upper_lip_left_contour3": {"x": 104, "y": 191}, "mouth_upper_lip_right_contour1": {"x": 139, "y": 185}, "mouth_upper_lip_right_contour2": {"x": 157, "y": 189}, "mouth_upper_lip_right_contour3": {"x": 151, "y": 194}, "mouth_upper_lip_top": {"x": 129, "y": 186}, "nose_contour_left1": {"x": 113, "y": 109}, "nose_contour_left2": {"x": 107, "y": 140}, "nose_contour_left3": {"x": 113, "y": 163}, "nose_contour_lower_middle": {"x": 129, "y": 168}, "nose_contour_right1": {"x": 144, "y": 109}, "nose_contour_right2": {"x": 151, "y": 140}, "nose_contour_right3": {"x": 145, "y": 163}, "nose_left": {"x": 100, "y": 155}, "nose_right": {"x": 159, "y": 154}, "nose_tip": {"x": 129, "y": 154}, "right_eye_bottom": {"x": 177, "y": 112}, "right_eye_center": {"x": 176, "y": 106}, "right_eye_left_corner": {"x": 155, "y": 109}, "right_eye_lower_left_quarter": {"x": 166, "y": 111}, "right_eye_lower_right_quarter": {"x": 187, "y": 109}, "right_eye_pupil": {"x": 175, "y": 104}, "right_eye_right_corner": {"x": 195, "y": 104}, "right_eye_top": {"x": 176, "y": 99}, "right_eye_upper_left_quarter": {"x": 165, "y": 102}, "right_eye_upper_right_quarter": {"x": 187, "y": 100}, "right_eyebrow_left_corner": {"x": 153, "y": 95}, "right_eyebrow_lower_left_quarter": {"x": 170, "y": 89}, "right_eyebrow_lower_middle": {"x": 185, "y": 84}, "right_eyebrow_lower_right_quarter": {"x": 199, "y": 81}, "right_eyebrow_right_corner": {"x": 210, "y": 84}, "right_eyebrow_upper_left_quarter": {"x": 167, "y": 79}, "right_eyebrow_upper_middle": {"x": 183, "y": 70}, "right_eyebrow_upper_right_quarter": {"x": 200, "y": 69}}, "attributes": {"gender": {"value": "Male"}, "age": {"value": 26}, "emotion": {"anger": 100.0, "disgust": 0.0, "fear": 0.0, "happiness": 0.0, "neutral": 0.0, "sadness": 0.0, "surprise": 0.0}}}, 4 5

これはFace++APIの顔画像からのjson形式で出力される感情推定結果を複数まとめたものです。

この"attributes"以下のキーと値を抽出して一つのリスト内辞書にまとめたいです。

リスト内辞書に関する似た投稿を調べてみましたが思った通りの出力結果が得られなかったので投稿させていただきました。

windows10
python

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

どのような結果が得たいのかよくわからないのですが、こういうことでしょうか?

python

1data = [{"face_token": "fca7b4c5c1910e9be6567d57e17ab457", "face_rectangle": {"top": 64, "left": 31, "width": 214, "height": 214}, "landmark": {"contour_chin": {"x": 117, "y": 273}, "contour_left1": {"x": 33, "y": 101}, "contour_left2": {"x": 33, "y": 124}, "contour_left3": {"x": 35, "y": 147}, "contour_left4": {"x": 37, "y": 169}, "contour_left5": {"x": 42, "y": 192}, "contour_left6": {"x": 49, "y": 213}, "contour_left7": {"x": 61, "y": 233}, "contour_left8": {"x": 76, "y": 250}, "contour_left9": {"x": 93, "y": 265}, "contour_right1": {"x": 247, "y": 107}, "contour_right2": {"x": 246, "y": 133}, "contour_right3": {"x": 242, "y": 159}, "contour_right4": {"x": 238, "y": 184}, "contour_right5": {"x": 230, "y": 209}, "contour_right6": {"x": 215, "y": 230}, "contour_right7": {"x": 195, "y": 247}, "contour_right8": {"x": 171, "y": 260}, "contour_right9": {"x": 146, "y": 271}, "left_eye_bottom": {"x": 77, "y": 107}, "left_eye_center": {"x": 79, "y": 101}, "left_eye_left_corner": {"x": 57, "y": 101}, "left_eye_lower_left_quarter": {"x": 66, "y": 104}, "left_eye_lower_right_quarter": {"x": 89, "y": 107}, "left_eye_pupil": {"x": 79, "y": 99}, "left_eye_right_corner": {"x": 100, "y": 107}, "left_eye_top": {"x": 79, "y": 92}, "left_eye_upper_left_quarter": {"x": 67, "y": 94}, "left_eye_upper_right_quarter": {"x": 91, "y": 97}, "left_eyebrow_left_corner": {"x": 42, "y": 80}, "left_eyebrow_lower_left_quarter": {"x": 55, "y": 76}, "left_eyebrow_lower_middle": {"x": 69, "y": 77}, "left_eyebrow_lower_right_quarter": {"x": 83, "y": 84}, "left_eyebrow_right_corner": {"x": 99, "y": 89}, "left_eyebrow_upper_left_quarter": {"x": 54, "y": 65}, "left_eyebrow_upper_middle": {"x": 71, "y": 65}, "left_eyebrow_upper_right_quarter": {"x": 87, "y": 74}, "mouth_left_corner": {"x": 78, "y": 189}, "mouth_lower_lip_bottom": {"x": 124, "y": 230}, "mouth_lower_lip_left_contour1": {"x": 98, "y": 208}, "mouth_lower_lip_left_contour2": {"x": 87, "y": 208}, "mouth_lower_lip_left_contour3": {"x": 101, "y": 223}, "mouth_lower_lip_right_contour1": {"x": 149, "y": 210}, "mouth_lower_lip_right_contour2": {"x": 159, "y": 211}, "mouth_lower_lip_right_contour3": {"x": 145, "y": 224}, "mouth_lower_lip_top": {"x": 124, "y": 217}, "mouth_right_corner": {"x": 168, "y": 193}, "mouth_upper_lip_bottom": {"x": 125, "y": 198}, "mouth_upper_lip_left_contour1": {"x": 117, "y": 191}, "mouth_upper_lip_left_contour2": {"x": 97, "y": 189}, "mouth_upper_lip_left_contour3": {"x": 102, "y": 194}, "mouth_upper_lip_right_contour1": {"x": 133, "y": 191}, "mouth_upper_lip_right_contour2": {"x": 151, "y": 191}, "mouth_upper_lip_right_contour3": {"x": 147, "y": 195}, "mouth_upper_lip_top": {"x": 125, "y": 193}, "nose_contour_left1": {"x": 109, "y": 104}, "nose_contour_left2": {"x": 100, "y": 141}, "nose_contour_left3": {"x": 105, "y": 170}, "nose_contour_lower_middle": {"x": 123, "y": 178}, "nose_contour_right1": {"x": 140, "y": 105}, "nose_contour_right2": {"x": 148, "y": 144}, "nose_contour_right3": {"x": 141, "y": 172}, "nose_left": {"x": 91, "y": 158}, "nose_right": {"x": 155, "y": 162}, "nose_tip": {"x": 124, "y": 164}, "right_eye_bottom": {"x": 173, "y": 109}, "right_eye_center": {"x": 172, "y": 104}, "right_eye_left_corner": {"x": 152, "y": 106}, "right_eye_lower_left_quarter": {"x": 162, "y": 108}, "right_eye_lower_right_quarter": {"x": 184, "y": 108}, "right_eye_pupil": {"x": 172, "y": 102}, "right_eye_right_corner": {"x": 193, "y": 105}, "right_eye_top": {"x": 172, "y": 95}, "right_eye_upper_left_quarter": {"x": 161, "y": 98}, "right_eye_upper_right_quarter": {"x": 183, "y": 98}, "right_eyebrow_left_corner": {"x": 150, "y": 92}, "right_eyebrow_lower_left_quarter": {"x": 169, "y": 90}, "right_eyebrow_lower_middle": {"x": 186, "y": 86}, "right_eyebrow_lower_right_quarter": {"x": 202, "y": 84}, "right_eyebrow_right_corner": {"x": 216, "y": 87}, "right_eyebrow_upper_left_quarter": {"x": 166, "y": 79}, "right_eyebrow_upper_middle": {"x": 184, "y": 72}, "right_eyebrow_upper_right_quarter": {"x": 204, "y": 72}}, "attributes": {"gender": {"value": "Male"}, "age": {"value": 26}, "emotion": {"anger": 98.934, "disgust": 1.06, "fear": 0.002, "happiness": 0.001, "neutral": 0.001, "sadness": 0.001, "surprise": 0.002}}}, 2 {"face_token": "b0df2c32adc1e411460823af811648c9", "face_rectangle": {"top": 68, "left": 19, "width": 213, "height": 213}, "landmark": {"contour_chin": {"x": 125, "y": 281}, "contour_left1": {"x": 30, "y": 104}, "contour_left2": {"x": 30, "y": 127}, "contour_left3": {"x": 32, "y": 151}, "contour_left4": {"x": 36, "y": 174}, "contour_left5": {"x": 43, "y": 197}, "contour_left6": {"x": 54, "y": 218}, "contour_left7": {"x": 67, "y": 238}, "contour_left8": {"x": 82, "y": 256}, "contour_left9": {"x": 100, "y": 273}, "contour_right1": {"x": 223, "y": 105}, "contour_right2": {"x": 223, "y": 129}, "contour_right3": {"x": 220, "y": 152}, "contour_right4": {"x": 216, "y": 176}, "contour_right5": {"x": 210, "y": 199}, "contour_right6": {"x": 199, "y": 220}, "contour_right7": {"x": 186, "y": 240}, "contour_right8": {"x": 170, "y": 258}, "contour_right9": {"x": 151, "y": 274}, "left_eye_bottom": {"x": 81, "y": 109}, "left_eye_center": {"x": 82, "y": 104}, "left_eye_left_corner": {"x": 63, "y": 102}, "left_eye_lower_left_quarter": {"x": 71, "y": 106}, "left_eye_lower_right_quarter": {"x": 91, "y": 109}, "left_eye_pupil": {"x": 81, "y": 104}, "left_eye_right_corner": {"x": 100, "y": 109}, "left_eye_top": {"x": 82, "y": 98}, "left_eye_upper_left_quarter": {"x": 72, "y": 98}, "left_eye_upper_right_quarter": {"x": 92, "y": 102}, "left_eyebrow_left_corner": {"x": 47, "y": 81}, "left_eyebrow_lower_left_quarter": {"x": 61, "y": 78}, "left_eyebrow_lower_middle": {"x": 75, "y": 82}, "left_eyebrow_lower_right_quarter": {"x": 88, "y": 90}, "left_eyebrow_right_corner": {"x": 104, "y": 95}, "left_eyebrow_upper_left_quarter": {"x": 60, "y": 69}, "left_eyebrow_upper_middle": {"x": 78, "y": 72}, "left_eyebrow_upper_right_quarter": {"x": 93, "y": 80}, "mouth_left_corner": {"x": 80, "y": 194}, "mouth_lower_lip_bottom": {"x": 125, "y": 236}, "mouth_lower_lip_left_contour1": {"x": 98, "y": 216}, "mouth_lower_lip_left_contour2": {"x": 89, "y": 214}, "mouth_lower_lip_left_contour3": {"x": 103, "y": 229}, "mouth_lower_lip_right_contour1": {"x": 152, "y": 218}, "mouth_lower_lip_right_contour2": {"x": 161, "y": 218}, "mouth_lower_lip_right_contour3": {"x": 147, "y": 231}, "mouth_lower_lip_top": {"x": 126, "y": 225}, "mouth_right_corner": {"x": 171, "y": 199}, "mouth_upper_lip_bottom": {"x": 128, "y": 194}, "mouth_upper_lip_left_contour1": {"x": 119, "y": 184}, "mouth_upper_lip_left_contour2": {"x": 98, "y": 186}, "mouth_upper_lip_left_contour3": {"x": 104, "y": 191}, "mouth_upper_lip_right_contour1": {"x": 139, "y": 185}, "mouth_upper_lip_right_contour2": {"x": 157, "y": 189}, "mouth_upper_lip_right_contour3": {"x": 151, "y": 194}, "mouth_upper_lip_top": {"x": 129, "y": 186}, "nose_contour_left1": {"x": 113, "y": 109}, "nose_contour_left2": {"x": 107, "y": 140}, "nose_contour_left3": {"x": 113, "y": 163}, "nose_contour_lower_middle": {"x": 129, "y": 168}, "nose_contour_right1": {"x": 144, "y": 109}, "nose_contour_right2": {"x": 151, "y": 140}, "nose_contour_right3": {"x": 145, "y": 163}, "nose_left": {"x": 100, "y": 155}, "nose_right": {"x": 159, "y": 154}, "nose_tip": {"x": 129, "y": 154}, "right_eye_bottom": {"x": 177, "y": 112}, "right_eye_center": {"x": 176, "y": 106}, "right_eye_left_corner": {"x": 155, "y": 109}, "right_eye_lower_left_quarter": {"x": 166, "y": 111}, "right_eye_lower_right_quarter": {"x": 187, "y": 109}, "right_eye_pupil": {"x": 175, "y": 104}, "right_eye_right_corner": {"x": 195, "y": 104}, "right_eye_top": {"x": 176, "y": 99}, "right_eye_upper_left_quarter": {"x": 165, "y": 102}, "right_eye_upper_right_quarter": {"x": 187, "y": 100}, "right_eyebrow_left_corner": {"x": 153, "y": 95}, "right_eyebrow_lower_left_quarter": {"x": 170, "y": 89}, "right_eyebrow_lower_middle": {"x": 185, "y": 84}, "right_eyebrow_lower_right_quarter": {"x": 199, "y": 81}, "right_eyebrow_right_corner": {"x": 210, "y": 84}, "right_eyebrow_upper_left_quarter": {"x": 167, "y": 79}, "right_eyebrow_upper_middle": {"x": 183, "y": 70}, "right_eyebrow_upper_right_quarter": {"x": 200, "y": 69}}, "attributes": {"gender": {"value": "Male"}, "age": {"value": 26}, "emotion": {"anger": 100.0, "disgust": 0.0, "fear": 0.0, "happiness": 0.0, "neutral": 0.0, "sadness": 0.0, "surprise": 0.0}}}] 3 4res = [] 5for d in data: 6 res.append(d['attributes']) 7 8print(res)

データをjsonとして読んでくるのであれば、こうですかね

python

1import json 2 3with open("sample.json") as f: 4 data = json.load(f) 5 6res = [] 7for d in data: 8 res.append(d['attributes']) 9 10print(res)

投稿2021/04/06 10:20

TakaiY

総合スコア12657

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Kokku

2021/04/06 10:30

ありがとうございます!自分の欲しい情報を取得することができました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問