Skripts
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
# Pfad zur Originaldatei
|
||||
input_file = "wfrp4e-eis-actors-extracted.json"
|
||||
output_directory = "actors_split"
|
||||
|
||||
# Stelle sicher, dass der Ausgabeordner existiert
|
||||
os.makedirs(output_directory, exist_ok=True)
|
||||
|
||||
# Datei einlesen
|
||||
with open(input_file, 'r', encoding='utf-8') as file:
|
||||
data = json.load(file)
|
||||
|
||||
# Einträge einzeln speichern
|
||||
for actor_id, actor_data in data.items():
|
||||
# Dateiname erstellen
|
||||
file_name = f"{output_directory}/{actor_id}.json"
|
||||
# Einzeln speichern
|
||||
with open(file_name, 'w', encoding='utf-8') as out_file:
|
||||
json.dump({actor_id: actor_data}, out_file, ensure_ascii=False, indent=4)
|
||||
|
||||
print(f"Einträge in {len(data)} Dateien aufgeteilt.")
|
||||
Reference in New Issue
Block a user