File size: 726 Bytes
1e9a83f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json

# ?????????
input_file = "support.json"
output_file = "support.json"

# ???? question ??
new_question = "I want to count objects in one specific color. How many of them are in my desired color?"

# ?? JSON ??
def update_question_field(input_file, output_file, new_question):
    with open(input_file, "r") as file:
        data = json.load(file)

    # ??????,?? question ??
    for entry in data:
        if "question" in entry:
            entry["question"] = new_question

    # ?????? JSON ??
    with open(output_file, "w") as file:
        json.dump(data, file, indent=4)

    print(f"Updated questions have been saved to {output_file}")

# ????
update_question_field(input_file, output_file, new_question)