web.py安装与helloworld

1.web.py安装(windows)

下载:http://webpy.org/static/web.py-0.37.tar.gz

安装:

(1).首先确定已经安装python并设置好环境变量

(2).打开cmd,cd到刚下载文件的目录下D:python_toolweb.py-0.37web.py-0.37

(3).输入python setup.py install

2.hello world

(1)新建helloworld.py,编写如下代码并保存

import web
urls=(
    '/',"index"
    )
class index:
    def GET(self):
        return "hello world"
if __name__=="__main__":
    app=web.application(urls,globals())
    app.run()

(2)运行,python helloworld.py

 (3)打开浏览器查看

原文地址:https://www.cnblogs.com/hidewsj/p/3228076.html