File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import json
2+ import os
3+
4+ # Load problem details
5+ with open ("problem_details.json" , "r" ) as f :
6+ problem_details = json .load (f )
7+
8+ # Define paths
9+ template_path = "problems/template.md"
10+ problem_dir = f"problems/{ problem_details ['questionId' ]} "
11+ github_username = os .getenv ('GITHUB_USERNAME' )
12+ problem_file = f"{ problem_dir } /{ github_username } .md" # Replace with actual username
13+
14+ # Create problem directory if it doesn't exist
15+ os .makedirs (problem_dir , exist_ok = True )
16+
17+ # Read template content
18+ with open (template_path , "r" ) as f :
19+ template_content = f .read ()
20+
21+ # Customize template with problem details
22+ note_content = template_content .replace ("<NUMBER>" , problem_details ['questionId' ])
23+ note_content = note_content .replace ("<TITLE>" , problem_details ['title' ])
24+ note_content = note_content .replace ("<LINK TO DESCRIPTION>" , problem_details ['link' ])
25+
26+ # Write customized note to new file
27+ with open (problem_file , "w" ) as f :
28+ f .write (note_content )
You can’t perform that action at this time.
0 commit comments