feat: script to output all the labels , initiation to parsing jsons, may use jquery on mac.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.env
|
||||
.venv
|
||||
sec_data/
|
||||
CIK*
|
||||
23
write_to_db.py
Normal file
23
write_to_db.py
Normal file
@@ -0,0 +1,23 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user