python跳转页面不能携带数据,Python 中的登陆获取数据跳转页面(不含数据库)

简单表单和模板:

import os.path

import tornado.httpserver

import tornado.ioloop

import tornado.options

import tornado.web

from tornado.options import define, options

define("port", default=8000, help="run on the given port", type=int)

class IndexHandler(tornado.web.RequestHandler):

def get(self):

self.render('index.html')

class PoemPageHandler(tornado.web.RequestHandler):

def post(self):

noun1 = self.get_argument('noun1')

noun2 = self.get_argument('noun2')

verb = self.get_argument('verb')

noun3 = self.get_argument('noun3')

self.render('poem.html', roads=noun1, wood=noun2, made=verb,

difference=noun3)

if __name__ == '__main__':

tornado.options.parse_command_line()

app = tornado.web.Application(

handlers=[(r'/', IndexHandler), (r'/poem', PoemPageHandler)],

template_path=os.path.join(os.path.dirname(__file__), "templates")

)

http_server = tornado.httpserver.HTTPServer(app)

http_server.listen(options.port)

tornado.ioloop.IOLoop.instance().start()

poemmaker.py

输入页面:

Poem Maker Pro

Enter terms below.

Plural noun

Singular noun

Verb (past tense)

Noun

index.html

输出页面:

Poem Maker Pro

Your poem

Two {{roads}} diverged in a {{wood}}, and I—

I took the one less travelled by,

And that has {{made}} all the {{difference}}.

poem.html

Python中,添加写入数据到已经存在的Excel的xls文件,即打开excel文件,写入新数据

背景 Python中,想要打开已经存在的excel的xls文件,然后在最后新的一行的数据. 折腾过程 1.找到了参考资料: writing to existing workbook using xlw ...

Python Socket请求网站获取数据

Python Socket请求网站获取数据 ---阻塞 I/O     ->收快递,快递如果不到,就干不了其他的活 ---非阻塞I/0 ->收快递,不断的去问,有没有送到,有没有送到,. ...

Python中生成(写入数据到)Excel文件

转自http://www.crifan.com/export_data_to_excel_file_in_python/ 在Python中,如何将数据,导出为Excel,即把数据写入到新生成的ex ...

vue 中使用 AJAX获取数据的方法

在VUE开发时,数据可以使用jquery和vue-resource来获取数据.在获取数据时,一定需要给一个数据初始值. 看下例:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值