Commit 3a645a24 by nzy

fix bugs: gitignore

parent fabd2413
...@@ -162,6 +162,4 @@ cython_debug/ ...@@ -162,6 +162,4 @@ cython_debug/
#.idea/ #.idea/
readme.pdf readme.pdf
test/ test/
# temporary scripts \ No newline at end of file
*.py
\ No newline at end of file
import re
codeblock_pattern = re.compile(r"```python(.+?)```", flags=re.DOTALL)
code_template = """```python
{}
```
"""
def extract_code(text: str):
codes = [match.strip() for match in re.findall(codeblock_pattern, text)]
if len(codes) > 0:
code = "\n".join(codes)
return code
else:
return ""
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment