python与web进行交互
来源:互联网 发布:淘宝一元拍卖是真的吗 编辑:程序博客网 时间:2024/06/04 19:09
我的想法: 通过 input.html 输入一些数字,传递到 result.py 中,result.py把输入的数字在数据库中查询出来,反馈到页面上。
=========input.thml============= code:
<html>
Please input the number:
<p>
<div class="top w960 center">
<form action="result.py" method="post">
number: <input type="text" name="txtWords"><br>
<input type="submit">
</div>
</form>
</html>
==========result.py============code:
#coding=utf-8
import cx_Oracle,os,sys,http.client,urllib.parse,urllib.request
words=request.post['txtWords']
conn = cx_Oracle.connect('wahaha','123456','18.97.27.6:1521/chrome')
cursor = conn.cursor()
sql = "select staff_number,cash,key_status,valid_time from staff_info where staff_number ='"+words+"'"
cursor.execute(sql)
for r in cursor.fetchall():print ("number: %s cash: %s status: %s valid: %s " % (r[0], r[1],r[2],r[3]))
===========================================
[color=Blue]代码执行以后,每次都是返回
Traceback (most recent call last):
File "D:\Soft\Python31\web\result.py", line 3, in
words=request.post['txtWords']
NameError: name 'request' is not defined[/color]
=========input.thml============= code:
<html>
Please input the number:
<p>
<div class="top w960 center">
<form action="result.py" method="post">
number: <input type="text" name="txtWords"><br>
<input type="submit">
</div>
</form>
</html>
==========result.py============code:
#coding=utf-8
import cx_Oracle,os,sys,http.client,urllib.parse,urllib.request
words=request.post['txtWords']
conn = cx_Oracle.connect('wahaha','123456','18.97.27.6:1521/chrome')
cursor = conn.cursor()
sql = "select staff_number,cash,key_status,valid_time from staff_info where staff_number ='"+words+"'"
cursor.execute(sql)
for r in cursor.fetchall():print ("number: %s cash: %s status: %s valid: %s " % (r[0], r[1],r[2],r[3]))
===========================================
[color=Blue]代码执行以后,每次都是返回
Traceback (most recent call last):
File "D:\Soft\Python31\web\result.py", line 3, in
words=request.post['txtWords']
NameError: name 'request' is not defined[/color]
0 0
- python与web进行交互
- App与web进行交互
- Python与C++进行交互
- python 使用mechanize进行web网页交互
- Android与web后台进行数据交互
- simulink与python进行数据交互
- Python Web.py与AJAX交互
- C++程序员学Python:C与Python进行交互
- web自定义放大工具(与地图进行交互)
- android通过HttpClient与web服务端进行数据交互
- iOS --- 使用RestKit与RESTful web服务器进行简单交互
- Android如何进行网络通信(与web交互)
- PHP后台数据处理及与web端进行数据交互
- 与插件进行交互
- Unity与web交互
- VC与web交互
- VC与Python交互
- VC与Python交互
- 没有人会提醒你,你的梦想还没有实现
- 组合设计模式
- zigbee 学习笔记
- AC自动机算法
- 定时调用WebService方法同步数据
- python与web进行交互
- 动态代理3--Spring AOP分析
- STD第三场 HDU 5326
- Google Android市场apk下载
- android Smali注入
- Android使用Activity用作弹出式对话框
- zigbee定位
- hadoop自带的存取小文件存取解决方案
- 用Node.js创建自签名的HTTPS服务器