Skip to content

Instantly share code, notes, and snippets.

@goddoe
Created August 18, 2023 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goddoe/7a04fe6dd10cf4d501de3a4e7415910c to your computer and use it in GitHub Desktop.
Save goddoe/7a04fe6dd10cf4d501de3a4e7415910c to your computer and use it in GitHub Desktop.
def strip_codeblock(code_with_codeblock):
first_newline_idx = code_with_codeblock.find("\n")
code_tmp = code_with_codeblock[first_newline_idx+1:]
code_closing_idx = code_tmp.find("```")
code_striped = code_tmp[:code_closing_idx]
return code_striped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment