如何创建一个像jupyter笔记本这样的具有交互式编程的App?
现在,我想开发一个关于交互式编程的应用程序,就像jupyter笔记本一样,但我对这方面知之甚少,有人可以告诉我一些方法或知识来开始开发这个应用程序。
Now, i want to develope a application about interactive programming ,just like jupyter notebook ,but i know little about this aspect,can someone tell me some ways or knowledge to start develope this app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阶段:
服务器将要执行的单元发送到客户端。
客户端执行单元并将结果返回到服务器。
两个虚拟环境之间的交互机制可以组织如下
server.py
:运行:
ServerSide/venv/Scripts/python -uB server.py
client.py
:在之后运行server.py:
ClientSide/venv/Scripts/python -uB client.py
在服务器端,输入代码块并发送 Ctrl+C。
在客户端执行,并将结果传回服务器端。
示例:
[Ctrl+C 发送代码块到客户端]
块>
打印(42 ** 42)
block>
[Ctrl+C 发送代码块到客户端]
block>
导入系统、时间
block>
print('1', file=sys.stdout); time.sleep(1)
block>
print('2', file=sys.stderr); time.sleep(1)
阻止>
引发异常('3')
阻止>
[Ctrl+C 发送代码块到客户端]
阻止>
导入系统
block>
s1 = sys.stdin.read()
阻止>
读取>
<多行>
阅读>
block>
s2 = sys.stdin.readline()
(或s2 = input()
< /强>)阻止>
readline>
<单行>
block>
s3 = sys.stdin.readlines()
阻止>
readlines>
<多行>
readlines>
块>
打印(s1, s2, s3)
block>
#interrupt
必须是最后一行代码):< br>[Ctrl+C 发送代码块到客户端]
阻止>
导入时间
块>
对于范围(10)内的 i:
块>
print(i)
block>
time.sleep(1)
阻止>
#interrupt
阻止>
[SERVER] 之前睡觉
[SERVER] 中断消息发送
#exit
必须是最后一行代码):[Ctrl+C 发送代码块到客户端]
阻止>
导入时间
块>
对于范围(10)内的 i:
块>
print(i)
block>
time.sleep(1)
阻止>
#exit
阻止>
[SERVER] 之前睡觉
[SERVER] 已发送退出消息
Stages:
The server sends cells for execution to the client.
The client executes the cells and returns the result to the server.
The mechanism of interaction between two virtual environments can be organized as follows
server.py
:Run:
ServerSide/venv/Scripts/python -uB server.py
client.py
:Run after server.py:
ClientSide/venv/Scripts/python -uB client.py
On the server side, enter code block and send Ctrl+C.
On the client side, it is executed, and the result is transmitted back to the server side.
Examples:
[Ctrl+C to send code block to client]
block>
print(42 ** 42)
block>
<Ctrl+C>
[Ctrl+C to send code block to client]
block>
import sys, time
block>
print('1', file=sys.stdout); time.sleep(1)
block>
print('2', file=sys.stderr); time.sleep(1)
block>
raise Exception('3')
block>
<Ctrl+C>
[Ctrl+C to send code block to client]
block>
import sys
block>
s1 = sys.stdin.read()
block>
<Ctrl+C>
read>
<Multi-line>
read>
<Ctrl+C>
block>
s2 = sys.stdin.readline()
(ors2 = input()
)block>
<Ctrl+C>
readline>
<One-line>
block>
s3 = sys.stdin.readlines()
block>
<Ctrl+C>
readlines>
<Multi-line>
readlines>
<Ctrl+C>
block>
print(s1, s2, s3)
block>
<Ctrl+C>
#interrupt
must be the last line of code):[Ctrl+C to send code block to client]
block>
import time
block>
for i in range(10):
block>
print(i)
block>
time.sleep(1)
block>
#interrupt
block>
<Ctrl+C>
[SERVER] Sleep before
[SERVER] Interrupt message sended
#exit
must be the last line of code):[Ctrl+C to send code block to client]
block>
import time
block>
for i in range(10):
block>
print(i)
block>
time.sleep(1)
block>
#exit
block>
<Ctrl+C>
[SERVER] Sleep before
[SERVER] Exit message sended