-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
43 lines (33 loc) · 1.09 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<!-- Manipulations nécessaires en JavaScript -->
<script type="module">
globalThis.words = await fetch('mots.txt')
.then(res => res.text());
const pythonCode = await fetch('pendu.py')
.then(res => res.text());
const pyscriptElement = document.createElement('py-script')
pyscriptElement.textContent = pythonCode;
document.body.appendChild(pyscriptElement);
console.log(pyscriptElement)
</script>
<!-- Manipulations nécessaires en Python -->
<py-script>
from js import words, alert, prompt
file = open('mots.txt', 'w')
file.write(words)
file.close()
def print(*args):
message = ' '.join(str(e) for e in args)
alert(message)
def input(message):
answer = prompt(message)
return answer
</py-script>
</body>
</html>