Python代码运行助手可以让你在线输入Python代码,然后通过本机运行的一个Python脚本来执行代码。原理如下:
- 在网页输入代码:
点击
Run
按钮,代码被发送到本机正在运行的Python代码运行助手;Python代码运行助手将代码保存为临时文件,然后调用Python解释器执行代码;
网页显示代码执行结果:
下载
点击右键,目标另存为:learning.py
备用下载地址:learning.py
运行
在存放learning.py
的目录下运行命令:
C:\Users\michael\Downloads> python learning.py
如果看到Ready for Python code on port 39093...
表示运行成功,不要关闭命令行窗口,最小化放到后台运行即可:
┌────────────────────────────────────────────────────────┐
│Command Prompt - □ x │
├────────────────────────────────────────────────────────┤
│Microsoft Windows [Version 10.0.0] │
│(c) 2015 Microsoft Corporation. All rights reserved. │
│ │
│C:\Users\michael\Downloads> python learning.py │
│Ready for Python code on port 39093... │
│Press Ctrl + C to exit... │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────┘
试试效果
需要支持HTML5的浏览器:
- IE >= 9
- Firefox
- Chrome
- Sarafi
# 测试代码:print(100+200) Run
300