【Python】Learn Python the hard way, ex50 第一个网站
来源:互联网 发布:战斗机模型数据 编辑:程序博客网 时间:2024/04/29 18:41
利用lpthw.web框架实现"Hello World"网页版,代码如下:
import weburls = ('/', 'index')app = web.application(urls, globals())render = web.template.render('templates/')class Index: def GET(self): greeting = 'Hello World' return render.index(greeting = greeting) if __name__ == '__main__': app.run()
另外,在templates文件夹内建立index.html模板文件,渲染文本,最终输出入下图所示
index.html内容如下:
$def with (greeting)<html><head><title>Gothons Of Planet Percal #25</title></head><body>$if greeting:I just wanted to say <em style='color: green; font-size:2em;'>$greeting</em>.$else:<em>Hello</em>, world!<body></html>
0 0
- 【Python】Learn Python the hard way, ex50 第一个网站
- learn python the hard way---ex50,ex51
- learn python the hard way ex50小坑
- Learn Python The Hard Way学习(50) - 你的第一个网站
- Learn Python The Hard Way
- Learn Python The Hard Way
- Learn Python the Hard Way ex48
- 学《learn python the hard way》(3)
- learn python the hard way 的ex48
- Learn Python The Hard Way-Ecercise1~5
- Learn Python The Hard Way-Ecercise6~10
- Learn Python The Hard Way-Ecercise11~15
- Learn Python The Hard Way-Ecercise16~20
- Learn Python The Hard Way-Ecercise21~25
- Learn Python The Hard Way-Ecercise26~30
- Learn Python The Hard Way-Ecercise31~35
- Learn Python The Hard Way-Ecercise36~40
- Learn Python The Hard Way exercise 42
- 《C++ primer》英文第五版阅读笔记(十六)——赋值运算符
- 通过其他程序的Internet Explorer_Server句柄打开网页
- JS中location对象使用
- 欢迎使用CSDN-markdown编辑器
- Mac MySQL修改密码
- 【Python】Learn Python the hard way, ex50 第一个网站
- MySQL创建中文数据库表
- JAVABEAN是什么和总结JAVABEAN的两种使用方式
- 什么是堆栈的构造方法?向上生长堆栈,向下生长堆栈
- unity使用texturepack更新图片时图片错位的解决
- CMake 用法导览
- java 单例模式
- 接口与抽象类区别
- Trapping Rain Water