This is a python inside html question.
I have been looking for some time and have come across this code that embeds python
inside a webpage (html).
I have tested it and it works. Here is the code:
The code script is saved as *.html
and opens (and runs) in the browser.
<!DOCTYPE html>
<head>
<script type="module" src="https://cdn.jsdelivr.net/gh/vanillawc/wc-code@1.0.3/src/wc-code.js"></script>
</head>
<body>
<wc-code mode="python">
<script type="wc-content">
a = 1
b = 1
print(a+b)
</script>
</wc-code>
</body>
The <script>
tag in the code above contains some basic python
code.
However, i cannot seem to import modules with a standard import module
call and was wondering if there was a way of doing this ?
Also, similarly, if there is a way of calling or importing a custom python script like my_code.py
?
Thanks