엔트리 채점 기능 수정 및 채점표 작성

This commit is contained in:
2025-02-14 00:47:21 +09:00
parent 49139c7543
commit 2e1ef0fc8a
7 changed files with 984 additions and 422 deletions

82
jsonPathTest.py Normal file
View File

@@ -0,0 +1,82 @@
import json
from jsonpath_ng import parse
# JSON 데이터
json_data = [
{
"id": "ro4n",
"x": 0,
"y": 0,
"type": "wait_second",
"params": [
{
"id": "6xf0",
"x": 0,
"y": 0,
"type": "number",
"params": ["1"],
"statements": [],
"movable": None,
"deletable": 1,
"emphasized": False,
"readOnly": None,
"copyable": True,
"assemble": True,
"extensions": []
},
None
],
"statements": [],
"movable": None,
"deletable": 1,
"emphasized": False,
"readOnly": None,
"copyable": True,
"assemble": True,
"extensions": []
},
{
"id": "kkqk",
"x": 0,
"y": 0,
"type": "wait_second",
"params": [
{
"id": "167c",
"x": 0,
"y": 0,
"type": "number",
"params": ["1"],
"statements": [],
"movable": None,
"deletable": 1,
"emphasized": False,
"readOnly": None,
"copyable": True,
"assemble": True,
"extensions": []
},
None
],
"statements": [],
"movable": None,
"deletable": 1,
"emphasized": False,
"readOnly": None,
"copyable": True,
"assemble": True,
"extensions": []
}
]
# JSONPath 표현식
jsonpath_expr = parse("$[?(@.type=='wait_second')][0]")
# 첫 번째 "wait_second" 요소 찾기
matches = [match.value for match in jsonpath_expr.find(json_data)]
# 출력
if matches:
print("첫 번째 wait_second 요소:", json.dumps(matches[0], indent=4, ensure_ascii=False))
else:
print("❌ 해당 요소를 찾을 수 없습니다.")