项目作者: programmingplus

项目描述 :
Python (CPython) in the browser.
高级语言: JavaScript
项目地址: git://github.com/programmingplus/pyjs.git
创建时间: 2021-02-15T17:39:53Z
项目社区:https://github.com/programmingplus/pyjs

开源协议:

下载


PyJS

Python (CPython) in the browser.

Demo

Getting Started

You can import the latest PyJS from CDN directly:

  1. <pre id="output"></pre>
  2. <script type="module">
  3. import { run } from "https://cdn.jsdelivr.net/npm/@programmingplus/pyjs";
  4. const output = (s) => (document.getElementById("output").textContent += s);
  5. run(`print(42 ** 42)`, { writeStdout: output, writeStderr: output });
  6. </script>

CodePen

Or, you may install PyJS with npm:

  1. $ npm install --save @programmingplus/pyjs

Purpose

To port CPython to the browser for education so that people can

  • run simple Python code directly in the browser
  • type things to standard input interactively
  • retrieve data from standard output and standard error