Python初学,web.py的Hello World

刚接触Python,稍稍看了下web.py,根据网上教程写了Hello World。

1、先下载web.py,然后解压,放到自己创建的项目目录。

2、用终端CD到web.py,执行:python setup.py install,在Linux 等系统下,需要root 的权限,可以执行:sudo python setup.py install。

3、CD到项目目录,执行“python index.py”,OK啦。

index.py源码如下:

import web

urls = ( '/(.*)', 'hello',)

class hello(object):
    def GET(self, name):
        return 'Hello World'

if __name__ == '__main__':
    app = web.application(urls, globals())
    app.run()

Demo地址:http://download.csdn.net/detail/u011439689/9740270

猜你喜欢

转载自blog.csdn.net/u011439689/article/details/54584928