- 论坛徽章:
- 0
|
原帖由 jxncyjq 于 2009-3-16 18:15 发表
del cur 是新cur对象删除
问题不是在这,我使用了
#! /usr/bin/python
import MySQLdb as sql
conn = sql.Connection('localhost','root')
cur = conn.cursor()
cur.execute('show databases')
list = cu ...
在我这个机器上试验了,没问题,楼主看下是不是其他原因
- [root@localhost]# cat 1.py
- #! /usr/bin/python
- import MySQLdb as sql
- conn = sql.Connection('localhost')
- cur = conn.cursor()
- cur.execute('show databases')
- list = cur.fetchall()
- print list
- cur.close()
- conn.close()
- [root@localhost]# python 1.py
- (('information_schema',), ('mysql',), ('test',), ('new',), ('MetaData',))
复制代码 |
|