web.py学习笔记
发布日期:2021-06-30 19:39:20
浏览次数:2
分类:技术文章
本文共 617 字,大约阅读时间需要 2 分钟。
code.py
import web# render = web.template.render('E:\\py_demo\\py_demo\\templates')root = os.path.dirname(__file__)templatesPath=root+'\\templates\\'render = web.template.render(templatesPath)urls = ( '/(.*)', 'index')class index: def GET(self,name): i = web.input(name=None) return render.index(i.name)if __name__ == "__main__": app = web.application(urls, globals()) app.run()
tmplates/index.html
$def with (name)$if name: I just wanted to say hello to $name.$else: Hello, world!
运行code.py
python code.py 127.0.0.1:8080 打开浏览器输入http://127.0.0.1:8080/?name=lin 得到I just wanted to say hello to lin.转载地址:https://linxinfa.blog.csdn.net/article/details/70952587 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
不错!
[***.144.177.141]2024年04月09日 08时46分27秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
强化学习(三) —— Policy Gradient 策略梯度
2019-04-30
docker安装oracle(win10)
2019-04-30
Cloudera Quickstart & HUE
2019-04-30
HUE
2019-04-30
CDH
2019-04-30
行为树 BT
2019-04-30
Cassandra & CQL
2019-04-30
Oracle数据库
2019-04-30
Oracle数据库命令
2019-04-30
有限状态机FSM
2019-04-30
Win10 Docker
2019-04-30
Python绘制动画并保存为gif/mp4 (matplotlib)
2019-04-30
PRM概率路线图
2019-04-30
ROS(六)——订阅者Subscriber的编程实现(C++ & Python)
2019-04-30
ROS(七)——话题消息的定义与使用
2019-04-30
yolov3入门实战
2019-04-30
B树 & B+树
2019-04-30
Node-Red(一)——简介与安装
2019-04-30
representation learning 表示学习/表征学习
2019-04-30
Haar特征
2019-04-30