25 lines
669 B
Python
25 lines
669 B
Python
import mariadb
|
|
import json
|
|
|
|
# Step 1: Load the JSON data from a file
|
|
with open('CIK0000320193.json', 'r') as file:
|
|
data = json.load(file)
|
|
|
|
# Step 2: Access the 'facts' section
|
|
facts_section = data.get('facts', {})
|
|
|
|
# Step 3: Initialize an empty list to store labels
|
|
labels_list = []
|
|
|
|
# Step 4: Iterate over each category in the 'facts' section
|
|
for category, facts in facts_section.items():
|
|
for fact_name, fact_data in facts.items():
|
|
label = fact_data.get('label')
|
|
if label:
|
|
labels_list.append(label)
|
|
|
|
# Step 5: Output the list of labels
|
|
print("List of all labels:")
|
|
for label in labels_list:
|
|
print(label)
|