Skip to content

Instantly share code, notes, and snippets.

@KenoLeon
Last active May 3, 2022 20:12
Show Gist options
  • Select an option

  • Save KenoLeon/a1afffa7b337f9bf5a3c171e3e5b8a45 to your computer and use it in GitHub Desktop.

Select an option

Save KenoLeon/a1afffa7b337f9bf5a3c171e3e5b8a45 to your computer and use it in GitHub Desktop.
Imports in PyScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<title>Imports in Pyscript, Numpy,Random in the Browser !</title>
<py-env>
- numpy
</py-env>
</head>
<body>
<py-script>
<!-- from pyodide packages : -->
import numpy as np
<!-- from standard lirary :-->
import random as rd
<!-- make linspace numpy -->
x = np.linspace(0, 10, 20)
print('linspace: ', x)
print('random: ', rd.random())
</py-script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment