python 语言入门(2017)

https://www.python.org/

window 7下实验:

  1、下载并且安装 https://www.python.org/ftp/python/3.6.0/python-3.6.0.exe

  2、cmd 运行后 执行python 会弹出一个命令行框,输入 print('ssss')   回车后会出现执行结果。

  3、在某盘中编辑一个 h.py 

    

# -*- coding:utf-8 -*- 
import web
urls = ('/(.*)','index')
 
app = web.application(urls,globals())

class index:   
    def GET(self, name):
        if not name:
            name = 'world'
        web.header('Content-Type','text/html; charset=UTF-8')
        return 'python web中文网页'
 
if __name__ == "__main__":
    app.run()
                   

  4、cmd中输入  python h.py 后会出现 http://0.0.0.0:8080 

  5、打开浏览器输入 http://localhost:8080  会出现 “python web中文网页 ” 说明运行成功。

 

posted @ 2017-03-21 14:27  清晴(lAT1-6)  阅读(219)  评论(0)    收藏  举报