Feat : Save exec block to file, More programming language supported in tools

This commit is contained in:
martin legrand
2025-02-24 09:59:28 +01:00
parent 72989b0811
commit 35022765f7
9 changed files with 318 additions and 45 deletions
+14 -5
View File
@@ -71,10 +71,19 @@ class PyInterpreter(Tools):
return False
if __name__ == "__main__":
codes = ["""
def test():
print("Hello world")
test()
"""]
text = """
Sure here is how to print in python:
```python:tmp.py
def print_hello():
hello = "Hello World"
print(hello)
print_hello()
```
"""
py = PyInterpreter()
codes, save_path = py.load_exec_block(text)
py.save_block(codes, save_path)
print(py.execute(codes))