I am using a function to grab my data from a json file and print it to a tkinter combo box, for some reason the first word always has {} in front of it. My json data doesn't have it so why does it appear in my output?
with open('profiles.txt', 'r') as file:
profiles = json.load(file)
for profile in profiles:
add_profile = profile['profile_name']
profiles_select['values'] = (profiles_select['values'], add_profile)
Values is also preset to have nothing in it so the values container code looks like this: profiles_select = ttk.Combobox(new_task_frame1, width=10, values=[])
Here is the json sample data:
[
{
"profile_name": "Main",
"first_name": "Michael ",
},
{
"profile_name": "Test",
"first_name": "Michael ",
}
]
This is what i expect to show up in my tkinter combo box :
Main
Test
This is what actually outputs
{}Main
Test
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…