在SAE的Python工程上使用MySQL
2015-02-03 14:21
253 查看
1、首先需要在SAE中创建一个python项目,详细参考SAE官方文档
http://sae.sina.com.cn/doc/python/tutorial.html
2、在创建的项目中的MySQL中创建一个表
3、使用如下代码访问
http://sae.sina.com.cn/doc/python/tutorial.html
2、在创建的项目中的MySQL中创建一个表
3、使用如下代码访问
import sae.const import string import MySQLdb _host=sae.const.MYSQL_HOST _user=sae.const.MYSQL_USER _passwd=sae.const.MYSQL_PASS _db=sae.const.MYSQL_DB _charset= 'utf-8' _port = string.atoi(sae.const.MYSQL_PORT) import time,MySQLdb conn = MySQLdb.connect(host= _host,port= _port,user= _user,passwd= _passwd, db=_db) cursor = conn.cursor() result = "" n = cursor.execute("select * from words") for row in cursor.fetchall(): for r in row: result = result + str(r) + " "
相关文章推荐
- Linux环境下MySQL-python使用小记
- python2.6使用mysql包出现的一些问题以及解决办法
- 在ubuntu下使用python代码访问mysql
- 使用logic analyzer和python对JTAG调试器进行逆向工程
- linux环境下的mysql-python使用注意事项
- Python中使用MySQL的BLOB字串类型
- python2.6使用mysql包出现的一些问题以及解决办法
- linux下使用pydev eclipse Mysql-python 搭建django开发环境
- MySQLdb的使用 Python操作Mysql
- python的mysql模块使用like查询
- 关于MySQLdb的一些新发现(使用python连接mysql的库)
- 使用python读取csv文件,并将数据更新至mysql
- 使用Python清理工程目录,方便代码备份
- 使用SAE-Python在虾米网自动签到
- 使用PYTHON遍历更改CVS项目工程服务器地址
- 使用visio做mysql反向工程
- python中使用MySQLdb连接mysql
- Python使用MySQLdb创建、调用MySQL存储过程
- python mysql使用持久链接
- python mysql安装使用