Skip to content
Snippets Groups Projects
Commit 4ca86c56 authored by monteiro's avatar monteiro
Browse files

Add tables

parent aafce621
No related branches found
No related tags found
No related merge requests found
riddles.md 0 → 100644
This diff is collapsed.
import pandas as pd
import json
# Load the JSON file
with open("trick_answers.json", "r", encoding="utf-8") as f:
data = json.load(f)
# Function to clean newlines from text
def clean_text(text):
if isinstance(text, str):
return text.replace("\n", " ") # Replace newlines with space
return text
# Clean the data
for entry in data:
for key in entry:
entry[key] = clean_text(entry[key])
# Convert to DataFrame
df = pd.DataFrame(data)
# Convert to Markdown table format
markdown_table = df.to_markdown(index=False)
# Save to a Markdown file
with open("trick_riddles.md", "w", encoding="utf-8") as f:
f.write(markdown_table)
print("Markdown table saved to riddles.md!")
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment