File size: 440 Bytes
42da440 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import os
def write_output_to_file(output, directory, uuid):
# Ensure directory exists
if not os.path.exists(directory):
os.makedirs(directory)
# Define the file path using the directory and UUID
file_path = os.path.join(directory, f"{uuid}.yaml")
# Write the output to the file
with open(file_path, "w", encoding="utf-8") as file:
file.write(output)
print(f"Output written to {file_path}")
|