Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ailogical
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
monteiro
ailogical
Commits
4ca86c56
Commit
4ca86c56
authored
1 week ago
by
monteiro
Browse files
Options
Downloads
Patches
Plain Diff
Add tables
parent
aafce621
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
riddles.md
+30
-0
30 additions, 0 deletions
riddles.md
tables.py
+29
-0
29 additions, 0 deletions
tables.py
trick_riddles.md
+20
-0
20 additions, 0 deletions
trick_riddles.md
with
79 additions
and
0 deletions
riddles.md
0 → 100644
+
30
−
0
View file @
4ca86c56
This diff is collapsed.
Click to expand it.
tables.py
0 → 100644
+
29
−
0
View file @
4ca86c56
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.
Click to expand it.
trick_riddles.md
0 → 100644
+
20
−
0
View file @
4ca86c56
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment