python代码运行助手怎么打开
发布网友
发布时间:2022-04-21 01:24
我来回答
共7个回答
热心网友
时间:2022-04-18 18:01
python代码运行助手是能在网页上运行python语言的工具。因为python的运行环境在很多教程里都是用dos的,黑乎乎的界面看的有点简陋,所以出了这python代码运行助手,作为ide。
实际上,python代码运行助手界面只能算及格分,如果要找ide,推荐使用jupyter。jupyter被集成到ANACONDA里,只要安装了anacoda就能使用了。
回到这个问题:
1、要打开这运行助手首先要下载一个learning.py,如果找不到可以复制如下代码另存为“learning.py”,编辑器用sublime、或者notepad++。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r'''
learning.py
A Python 3 tutorial from http://www.liaoxuefeng.com
Usage:
python3 learning.py
'''
import sys
def check_version():
v = sys.version_info
if v.major == 3 and v.minor >= 4:
return True
print('Your current python is %d.%d. Please use Python 3.4.' % (v.major, v.minor))
return False
if not check_version():
exit(1)
import os, io, json, subprocess, tempfile
from urllib import parse
from wsgiref.simple_server import make_server
EXEC = sys.executable
PORT = 39093
HOST = 'local.liaoxuefeng.com:%d' % PORT
TEMP = tempfile.mkdtemp(suffix='_py', prefix='learn_python_')
INDEX = 0
def main():
httpd = make_server('127.0.0.1', PORT, application)
print('Ready for Python code on port %d...' % PORT)
httpd.serve_forever()
def get_name():
global INDEX
INDEX = INDEX + 1
return 'test_%d' % INDEX
def write_py(name, code):
fpath = os.path.join(TEMP, '%s.py' % name)
with open(fpath, 'w', encoding='utf-8') as f:
f.write(code)
print('Code wrote to: %s' % fpath)
return fpath
def decode(s):
try:
return s.decode('utf-8')
except UnicodeDecodeError:
return s.decode('gbk')
def application(environ, start_response):
host = environ.get('HTTP_HOST')
method = environ.get('REQUEST_METHOD')
path = environ.get('PATH_INFO')
if method == 'GET' and path == '/':
start_response('200 OK', [('Content-Type', 'text/html')])
return [b'<html><head><title>Learning Python</title></head><body><form method="post" action="/run"><textarea name="code" style="width:90%;height: 600px"></textarea><p><button type="submit">Run</button></p></form></body></html>']
if method == 'GET' and path == '/env':
start_response('200 OK', [('Content-Type', 'text/html')])
L = [b'<html><head><title>ENV</title></head><body>']
for k, v in environ.items():
p = '<p>%s = %s' % (k, str(v))
L.append(p.encode('utf-8'))
L.append(b'</html>')
return L
if host != HOST or method != 'POST' or path != '/run' or not environ.get('CONTENT_TYPE', '').lower().startswith('application/x-www-form-urlencoded'):
start_response('400 Bad Request', [('Content-Type', 'application/json')])
return [b'{"error":"bad_request"}']
s = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
qs = parse.parse_qs(s.decode('utf-8'))
if not 'code' in qs:
start_response('400 Bad Request', [('Content-Type', 'application/json')])
return [b'{"error":"invalid_params"}']
name = qs['name'][0] if 'name' in qs else get_name()
code = qs['code'][0]
headers = [('Content-Type', 'application/json')]
origin = environ.get('HTTP_ORIGIN', '')
if origin.find('.liaoxuefeng.com') == -1:
start_response('400 Bad Request', [('Content-Type', 'application/json')])
return [b'{"error":"invalid_origin"}']
headers.append(('Access-Control-Allow-Origin', origin))
start_response('200 OK', headers)
r = dict()
try:
fpath = write_py(name, code)
print('Execute: %s %s' % (EXEC, fpath))
r['output'] = decode(subprocess.check_output([EXEC, fpath], stderr=subprocess.STDOUT, timeout=5))
except subprocess.CalledProcessError as e:
r = dict(error='Exception', output=decode(e.output))
except subprocess.TimeoutExpired as e:
r = dict(error='Timeout', output='执行超时')
except subprocess.CalledProcessError as e:
r = dict(error='Error', output='执行错误')
print('Execute done.')
return [json.mps(r).encode('utf-8')]
if __name__ == '__main__':
main()
2,再用一个记事本写如下的代码:
@echo off
python learning.py
pause
另存为‘运行.bat’
3、把“运行.bat”和“learning.py”放到同一目录下,
4、双击运行“运行.bat",之后会弹出黑色的dos窗口,这个窗口不要关闭。
5、输入网址对应的网址和端口,整个过程就完成了。
热心网友
时间:2022-04-18 19:19
是廖雪峰的python教程吧,下载learning.py,在cmd里运行,然后在教程的页面里面就可以用了。目的是网页里就可以测试代码。
热心网友
时间:2022-04-18 20:53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r'''
learning.py
A Python 3 tutorial from http://www.liaoxuefeng.com
Usage:
python3 learning.py
'''
import sys
def check_version():
v = sys.version_info
if v.major == 3 and v.minor >= 4:
return True
print('Your current python is %d.%d. Please use Python 3.4.' % (v.major, v.minor))
return False
if not check_version():
exit(1)
import os, io, json, subprocess, tempfile
from urllib import parse
from wsgiref.simple_server import make_server
EXEC = sys.executable
PORT = 39093
HOST = 'local.liaoxuefeng.com:%d' % PORT
TEMP = tempfile.mkdtemp(suffix='_py', prefix='learn_python_')
INDEX = 0
def main():
httpd = make_server('127.0.0.1', PORT, application)
print('Ready for Python code on port %d...' % PORT)
httpd.serve_forever()
def get_name():
global INDEX
INDEX = INDEX + 1
return 'test_%d' % INDEX
def write_py(name, code):
fpath = os.path.join(TEMP, '%s.py' % name)
with open(fpath, 'w', encoding='utf-8') as f:
f.write(code)
print('Code wrote to: %s' % fpath)
return fpath
def decode(s):
try:
return s.decode('utf-8')
except UnicodeDecodeError:
return s.decode('gbk')
def application(environ, start_response):
host = environ.get('HTTP_HOST')
method = environ.get('REQUEST_METHOD')
path = environ.get('PATH_INFO')
if method == 'GET' and path == '/':
start_response('200 OK', [('Content-Type', 'text/html')])
return [b'<html><head><title>Learning Python</title></head><body><form method="post" action="/run"><textarea name="code" style="width:90%;height: 600px"></textarea><p><button type="submit">Run</button></p></form></body></html>']
if method == 'GET' and path == '/env':
start_response('200 OK', [('Content-Type', 'text/html')])
L = [b'<html><head><title>ENV</title></head><body>']
for k, v in environ.items():
p = '<p>%s = %s' % (k, str(v))
L.append(p.encode('utf-8'))
L.append(b'</html>')
return L
if host != HOST or method != 'POST' or path != '/run' or not environ.get('CONTENT_TYPE', '').lower().startswith('application/x-www-form-urlencoded'):
start_response('400 Bad Request', [('Content-Type', 'application/json')])
return [b'{"error":"bad_request"}']
s = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
qs = parse.parse_qs(s.decode('utf-8'))
if not 'code' in qs:
start_response('400 Bad Request', [('Content-Type', 'application/json')])
return [b'{"error":"invalid_params"}']
name = qs['name'][0] if 'name' in qs else get_name()
code = qs['code'][0]
headers = [('Content-Type', 'application/json')]
origin = environ.get('HTTP_ORIGIN', '')
if origin.find('.liaoxuefeng.com') == -1:
start_response('400 Bad Request', [('Content-Type', 'application/json')])
return [b'{"error":"invalid_origin"}']
headers.append(('Access-Control-Allow-Origin', origin))
start_response('200 OK', headers)
r = dict()
try:
fpath = write_py(name, code)
print('Execute: %s %s' % (EXEC, fpath))
r['output'] = decode(subprocess.check_output([EXEC, fpath], stderr=subprocess.STDOUT, timeout=5))
except subprocess.CalledProcessError as e:
r = dict(error='Exception', output=decode(e.output))
except subprocess.TimeoutExpired as e:
r = dict(error='Timeout', output='执行超时')
except subprocess.CalledProcessError as e:
r = dict(error='Error', output='执行错误')
print('Execute done.')
return [json.mps(r).encode('utf-8')]
if __name__ == '__main__':
main()
Python代码运行助手
热心网友
时间:2022-04-18 22:45
python代码运行助手怎么打开:
Python代码运行助手可以在线输入Python代码,通过本机运行的一个Python脚本来执行代码。
在网页输入代码。
点击Run按钮,代码被发送到本机正在运行的Python代码运行助手。Python代码运行助手将代码保存为临时文件,然后调用Python解释器执行代码。网页显示代码执行结果。
运行在存放learning.py的目录下运行命令。(需要支持HTML5的浏览器)
python代码运行助手怎么打开的延伸:
python代码运行助手的使用方法:
要打开这运行助手首先要下载一个learning.py。(找不到可以复制如下代码另存为learning.py)
用一个记事本写如下的代码:
另存为运行.bat
把运行.bat和learning.py放到同一目录下。
双击运行运行.bat,之后会弹出黑色的dos窗口,这个窗口不要关闭。
输入网址对应的网址和端口,整个过程完成。
热心网友
时间:2022-04-19 00:53
这个不用打开,你安装好代码运行助手后,在浏览器可以直接使用,如果不能建议你更换为 谷歌浏览器,IE9+ 火狐
热心网友
时间:2022-04-19 03:17
找到图标,双击打开
热心网友
时间:2022-04-19 05:59
先附代码
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os, io, json, subprocess, tempfile, ssl
from urllib import parse
from http.server import HTTPServer, BaseHTTPRequestHandler, SimpleHTTPRequestHandler
EXEC = sys.executable
PORT = 39093
TEMP = tempfile.mkdtemp(suffix='_py', prefix='learn_python_')
HTML_INDEX = r'''
<html>
<head><title>Learning Python</title></head>
<body>
<form method="post" action="/run">
<textarea name="code" style="width:90%;height: 600px"></textarea>
<p><button type="submit">Run</button></p>
</form>
</body>
</html>
'''
class LearningHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.close_connection = True
if self.path != '/':
return self.send_error(404)
self._sendHttpHeader('text/html')
self._sendHttpBody(HTML_INDEX)
def do_POST(self):
self.close_connection = True
if self.path != '/run':
return self.send_error(400)
print('Prepare code...')
body = self.rfile.read(int(self.headers['Content-length']))
qs = parse.parse_qs(body.decode('utf-8'))
if not 'code' in qs:
return self.send_error(400)
code = qs['code'][0]
r = dict()
try:
fpath = write_py(get_name(), code)
print('Execute: %s %s' % (EXEC, fpath))
r['output'] = decode(subprocess.check_output([EXEC, fpath], stderr=subprocess.STDOUT, timeout=5))
except subprocess.CalledProcessError as e:
r = dict(error='Exception', output=decode(e.output))
except subprocess.TimeoutExpired as e:
r = dict(error='Timeout', output='执行超时')
except subprocess.CalledProcessError as e:
r = dict(error='Error', output='执行错误')
print('Execute done.')
self._sendHttpHeader()
self._sendHttpBody(r)
def _sendHttpHeader(self, contentType='application/json'):
origin = self.headers['Origin'] or 'https://www.liaoxuefeng.com'
self.send_response(200)
self.send_header('Content-Type', contentType)
self.send_header('Access-Control-Allow-Origin', origin)
self.send_header('Access-Control-Allow-Methods', 'GET,POST')
self.send_header('Access-Control-Max-Age', '86400')
self.end_headers()
def _sendHttpBody(self, data):
body = b''
if isinstance(data, bytes):
body = data
elif isinstance(data, str):
body = data.encode('utf-8', errors='ignore')
else:
body = json.mps(data).encode('utf-8', errors='ignore')
self.wfile.write(body)
def main():
certfile = write_cert()
httpd = HTTPServer(('127.0.0.1', PORT), LearningHTTPRequestHandler)
#httpd.socket = ssl.wrap_socket(httpd.socket, certfile=certfile, server_side=True)
#注释禁用证书验证~~~
print('Ready for Python code on port %d...' % PORT)
print('Press Ctrl + C to exit...')
httpd.serve_forever()
# functions ###################################################################
INDEX = 0
def get_name():
global INDEX
INDEX = INDEX + 1
return 'test_%d' % INDEX
def write_py(name, code):
fpath = os.path.join(TEMP, '%s.py' % name)
with open(fpath, 'w', encoding='utf-8') as f:
f.write(code)
print('Code wrote to: %s' % fpath)
return fpath
def decode(s):
try:
return s.decode('utf-8')
except UnicodeDecodeError:
return s.decode('gbk')
# certificate #################################################################
def write_cert():
fpath = os.path.join(TEMP, 'local.liaoxuefeng.com.pem')
with open(fpath, 'w', encoding='utf-8') as f:
f.write(CERT_DATA)
return fpath
CERT_DATA = r'''
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEArNs0nkOrt8Bq5latEhaUU9GB6cHwTcuzWaNPtIBEnREJPyp2
S2YqceCH2r6jjdoO+WUH44jteY4G1gz5qnOGrMDum7d5yZxr0XnAMzKNNvmQ5R+z
iOvHSYdk9BVBpx0V3zOW/a97zsJCA/1B+qyyQfWSy6LtbWTgoQ3LWYdQJ4AjL4jd
KcBmsGhs/K+xM8E9xssV6E4Swn6IoUVfLBQzqgRz10ST9cLxhOR7k/0QJcESeCMu
q7NMJgdR6A74/AOys0jzCugDf8RxJns0M+CJ+91krTdn1l0T2Wy4vRjQvAw6Xtdg
0mKEvbpxl8LhgcQQwEl3FkjqNqfW0EM2Eb8lHQIDAQABAoIBAD/e35p7NsA3AUkL
TfgZD8XI7FALsVeNpT/B8Hmpy7Cd0uTcM8m4foaFiK1zM8v+fvn4MuoIdncr26rM
MJSjC2haAdDYAtBUVCKa8kH4s+VUYg3HoPc+5+xrcwodsJynSqWm0mv6o6zKaso+
klql5Vgp/YvxL/n0BGx+RF1Yem2ddja7flzrbpgaqEbu78OEvBpXQniQRQ3u2ifS
Xl+Nyi4HKfxT58CThs8HHHHmuMX/570bA/C44aHZli/tHz5icnSwTHfdy8SlNZIt
7IE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AgEwDQYJKoZIhvcNAQELBQADggEBAK3dVOj5dlv4MzK2i233
lDYvyJ3slFY2X2HKTYGte8nbK6i5/fsDImMYihAkp6VaNY/en8WZ5qcrQPVLuJrJ
DSXT04NnMeZOQDUoj/NHAmdfCBB/h1bZ5OGK6Sf1h5Yx/5wR4f3TUoPgGlnU7EuP
ISLNdMRiDrXntcImDAiRvkh5GJuH4YCVE6XEntqaNIgGkRwxKSgnU3Id3iuFbW9F
UQ9Qqtb1GX91AJ7i4153TikGgYCdwYkBURD8gSVe8OAco6IfZOYt/TEwii1Ivi1C
qnuUlWpsF1LdQNIdfbW3TSe0BhQa7ifbVIfvPWHYOu3rkg1ZeMo6XRU9B4n5VyJY
RmE=
-----END CERTIFICATE-----
'''
# start main at last ##########################################################
if __name__ == '__main__':
main()
注意:第81行"httpd.socket = ssl.wrap_socket(httpd.socket, certfile=certfile, server_side=True)"注释掉,禁用证书认证否则打不开
然后打开这个文件浏览器输入"127.0.0.1:39093"(任何电脑都可以),或者放到网站上输入"域名:39093"即可打开
如果仍然打不开计算机名不要包含英文,关掉防火墙即可
望采纳