当前位置:   article > 正文

python在线工具-Skulpt在线模拟运行Python工具

skulpt客户端python模拟器

function outf(text) {

var mypre = document.getElementById("output");

mypre.innerHTML = mypre.innerHTML + text;

}

function builtinRead(x) {

if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)

throw "File not found: '" + x + "'";

return Sk.builtinFiles["files"][x];

}

function runit() {

var prog = document.getElementById("yourcode").value;

var mypre = document.getElementById("output");

mypre.innerHTML = '';

Sk.pre = "output";

Sk.configure({ output: outf, read: builtinRead, __future__: Sk.python3});

(Sk.TurtleGraphics || (Sk.TurtleGraphics = {})).target = 'mycanvas';

var myPromise = Sk.misceval.asyncToPromise(function() {

return Sk.importMainWithBody("", false, prog, true);

});

myPromise.then(function(mod) {

console.log('success');

},

function(err) {

console.log(err.toString());

});

}

Try This

import turtle

print('hello')

t = turtle.Turtle()

t.color('red')

t.forward(75)


Run

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/643216
推荐阅读
相关标签
  

闽ICP备14008679号