id eId-75657625 source 1 target 75657625 label style strokeWidth 2 markerEnd type arrowclosed width 20 height 20 id e
Assuming the given object is a list of dictionaries, we can use a for loop to iterate through the list and check for the dictionary with the id value of 472887162. If found, we can return the dictionary. Here's an example:
obj_list = [
{
"id": "eId-75657625",
"source": "1",
"target": "75657625",
"label": "",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"id": "eId-506004445",
"source": "75657625",
"target": "506004445",
"label": "",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"id": "eId-965166501",
"source": "506004445",
"target": "965166501",
"sourceHandle": "a",
"label": "True",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"id": "eId-290190680",
"source": "506004445",
"target": "290190680",
"sourceHandle": "b",
"label": "False",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"id": "eId-472887162",
"source": "290190680",
"target": "472887162",
"label": "",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"id": "eId-566016147",
"source": "472887162",
"target": "566016147",
"sourceHandle": "b",
"label": "False",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"id": "eId-834736475",
"source": "472887162",
"target": "834736475",
"sourceHandle": "a",
"label": "True",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
},
{
"source": "834736475",
"sourceHandle": None,
"target": "2",
"targetHandle": None,
"type": "buttonedge",
"id": "reactflow__edge-834736475-2",
},
{
"source": "566016147",
"sourceHandle": None,
"target": "2",
"targetHandle": None,
"type": "buttonedge",
"id": "reactflow__edge-566016147-2",
},
{
"id": "eId-866813082",
"source": "965166501",
"target": 2,
"label": "",
"style": {"strokeWidth": 2},
"markerEnd": {"type": "arrowclosed", "width": 20, "height": 20},
"type": "buttonedge",
},
]
for obj in obj_list:
if obj.get("id") == "eId-472887162":
print(obj)
break
Output:
{'id': 'eId-472887162', 'source': '290190680', 'target': '472887162', 'label': '', 'style': {'strokeWidth': 2}, 'markerEnd': {'type': 'arrowclosed', 'width': 20, 'height': 20}}
``
原文地址: https://www.cveoy.top/t/topic/fUPG 著作权归作者所有。请勿转载和采集!