[英]Run a python program from browser
I want to run a python program (kinda like this) from a browser 我想从浏览器运行python程序(像这样)
Anyway, as you see it has a few inputs, and i would like to "translate" that into a kind of form 无论如何,如您所见,它有一些输入,我想将其“翻译”成一种形式
def addNew():
appendBase = open('dBase.cfg','a')
uname = input('Username: ')
pword = input('Password: ')
appendBase.write(uname+','+pword+'\n')
print('\nAdded new profile: \n'+uname+','+pword)
appendBase.close()
Also i dont know how to get the print to the page, so it can show it 我也不知道如何将打印内容打印到页面上,所以它可以显示它
I've just started learning, so go easy on me, please 我刚刚开始学习,所以请放轻松
It is not possible to actually run this in the browser, for various reasons. 由于各种原因,不可能在浏览器中实际运行它。
open
local files from a browser open
本地文件 input
from some terminal input
Most things you see on the web have two parts 您在网络上看到的大多数内容都有两个部分
The two parts communicate using HTTP protocol. 这两个部分使用HTTP协议进行通信。 So, start by reading a bit on HTML/javascript ( W3Schools is an easy way to get started).
因此,从阅读HTML / javascript开始( W3Schools是入门的简便方法)。 When you feel comfortable with that, practice with a python web framework ( django is the most popular, but flask is the easiest to get started), and see how javascript uses HTTP to connect to that.
当您对此感到满意时,请尝试使用python网络框架进行练习( django是最受欢迎的,但最容易入门的是flask ),并查看javascript如何使用HTTP连接到该框架。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.